Filter

Struct Filter 

Source
pub struct Filter<I, P> { /* private fields */ }
Expand description

An adapter for filtering items in an OutputIterator. This is created by the filter method on OutputIterator. See its documentation for more.

Trait Implementations§

Source§

impl<I, P> OutputIterator for Filter<I, P>
where I: OutputIterator, P: FnMut(&I::Item) -> bool,

Source§

type Item = <I as OutputIterator>::Item

The type of items yielded by this iterator.
Source§

type Output = <I as OutputIterator>::Output

The type of the intermediate output produced by this iterator.
Source§

type AfterOutput = Filter<<I as OutputIterator>::AfterOutput, P>

The type of the iterator after the intermediate output is produced.
Source§

fn next(self) -> OutputIteratorVariant<Self>

Advances the iterator, returning either the next item or the intermediate output. Read more
Source§

fn into_iter(self, buf: &mut Self::Output) -> IntoIter<'_, Self>

Converts this OutputIterator into a standard iterator, using a mutable buffer to store the intermediate output. Upon completion, output buffer will be overridden with the output of the iterator.
Source§

fn into_iter_option( self, buf: &mut Option<Self::Output>, ) -> IntoIterOption<'_, Self>

Converts this OutputIterator into an iterator, and a reference to the optional buffer. At the moment of creation, the buffer will be None, and upon completion it will be Some with output of the iterator.
Source§

fn ignore_output(self) -> IgnoreOutput<Self>

Converts this OutputIterator into an iterator that ignores the intermediate output.
Source§

fn until_output( self, f: impl FnMut(Self::Item), ) -> (Self::AfterOutput, Self::Output)

Processes items until the intermediate output is encountered, calling closure for each yielded item.
Source§

fn until_output_iter<F>(self, f: F) -> (Self::AfterOutput, Self::Output)
where F: FnOnce(&mut UntilOutput<Self>),

Similar to until_output, but instead gives an iterator when it is more convenient to use it. Iterator only yields items until the intermediate output has been received, and no more.
Source§

fn foreach(self, f: impl FnMut(Self::Item)) -> Self::Output

Iterates over all items, applying a closure to each item. Returns produced output.
Source§

fn map_output<B, F>(self, f: F) -> MapOutput<Self, F>
where F: FnOnce(Self::Output) -> B,

Maps the intermediate output using the provided function.
Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where Self: Sized, F: FnMut(Self::Item) -> B,

Takes a closure and creates an output iterator which calls that closure on each Item.
Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where P: FnMut(&Self::Item) -> bool,

Filters out the Items on which the predicate returns false.

Auto Trait Implementations§

§

impl<I, P> Freeze for Filter<I, P>
where I: Freeze, P: Freeze,

§

impl<I, P> RefUnwindSafe for Filter<I, P>

§

impl<I, P> Send for Filter<I, P>
where I: Send, P: Send,

§

impl<I, P> Sync for Filter<I, P>
where I: Sync, P: Sync,

§

impl<I, P> Unpin for Filter<I, P>
where I: Unpin, P: Unpin,

§

impl<I, P> UnwindSafe for Filter<I, P>
where I: UnwindSafe, P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.