pub struct FilterMap<Gen, Func> { /* private fields */ }
Expand description
Implements a mapped generator. See .map()
for details.
Implementations§
Trait Implementations§
Source§impl<Gen, Func, Out> Generator for FilterMap<Gen, Func>
impl<Gen, Func, Out> Generator for FilterMap<Gen, Func>
Source§fn run(
&mut self,
output: impl FnMut(Self::Output) -> ValueResult,
) -> GeneratorResult
fn run( &mut self, output: impl FnMut(Self::Output) -> ValueResult, ) -> GeneratorResult
Run the generator, emitting values to the
output
closure. Read moreSource§fn try_advance(&mut self, n: NonZeroUsize) -> (usize, GeneratorResult)
fn try_advance(&mut self, n: NonZeroUsize) -> (usize, GeneratorResult)
Try to advance the generator
n
values, ignoring them. Read moreAuto Trait Implementations§
impl<Gen, Func> Freeze for FilterMap<Gen, Func>
impl<Gen, Func> RefUnwindSafe for FilterMap<Gen, Func>where
Gen: RefUnwindSafe,
Func: RefUnwindSafe,
impl<Gen, Func> Send for FilterMap<Gen, Func>
impl<Gen, Func> Sync for FilterMap<Gen, Func>
impl<Gen, Func> Unpin for FilterMap<Gen, Func>
impl<Gen, Func> UnwindSafe for FilterMap<Gen, Func>where
Gen: UnwindSafe,
Func: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DynGenerator for Twhere
T: Generator,
impl<T> DynGenerator for Twhere
T: Generator,
Source§fn run_dyn(
&mut self,
output: &mut dyn FnMut(<T as DynGenerator>::Output) -> ValueResult,
) -> GeneratorResult
fn run_dyn( &mut self, output: &mut dyn FnMut(<T as DynGenerator>::Output) -> ValueResult, ) -> GeneratorResult
Run the generator using a
&mut dyn FnMut
instead of impl FnMut
. ThisSource§impl<T> GeneratorExt for Twhere
T: Generator,
impl<T> GeneratorExt for Twhere
T: Generator,
Source§fn all<F>(&mut self, predicate: F) -> bool
fn all<F>(&mut self, predicate: F) -> bool
Tests if every value from the generator matches a predicate. Read more
Source§fn next(&mut self) -> Result<Self::Output, GeneratorResult>
fn next(&mut self) -> Result<Self::Output, GeneratorResult>
Retrieve the next value from the generator Read more
Source§fn last(self) -> Option<Self::Output>where
Self: Sized,
fn last(self) -> Option<Self::Output>where
Self: Sized,
Exhausts the generator, returning the last element. Read more
Source§fn cloned<'a, T>(self) -> Cloned<Self>
fn cloned<'a, T>(self) -> Cloned<Self>
Creates a generator that clones all of its elements. Read more
Source§fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Creates a generator that copies all of its elements. Read more
Source§fn chain<Gen>(self, other: Gen) -> Chain<Self, Gen>
fn chain<Gen>(self, other: Gen) -> Chain<Self, Gen>
Creates a generator by chaining two generators, running them one after the other. Read more
Source§fn filter<Pred>(self, predicate: Pred) -> Filter<Self, Pred>
fn filter<Pred>(self, predicate: Pred) -> Filter<Self, Pred>
Create a filtered generator. Only values for which the predicate returns true will be passed on. Read more
Source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
Creates a generator that both filters and maps. Read more
Source§fn map<Trans, Out>(self, transform_fn: Trans) -> Map<Self, Trans>
fn map<Trans, Out>(self, transform_fn: Trans) -> Map<Self, Trans>
Takes a closure and creates a generator which calls the closure on each value. Read more
Source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
Skips over
n
values, consuming and ignoring them. Read moreSource§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
Creates a generator that skips values based on a predicate. Read more
Source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
Takes
n
values and then completes the generator. Read moreSource§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
Creates a generator that pushes values based on a predicate. Read more
Source§fn flat_map<U, F>(self, f: F) -> Flatten<Map<Self, F>>
fn flat_map<U, F>(self, f: F) -> Flatten<Map<Self, F>>
Creates a generator that works like map, but flattens nested structure. Read more
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Creates a generator that flattens nested structure. Read more
Source§fn for_each<Func>(&mut self, func: Func) -> GeneratorResult
fn for_each<Func>(&mut self, func: Func) -> GeneratorResult
Run a generator to completion, or until it is stopped, and call a closure for each value
produced by the generator. Read more
Source§fn try_for_each<F, E>(&mut self, f: F) -> Result<(), E>
fn try_for_each<F, E>(&mut self, f: F) -> Result<(), E>
A generator method that applies a fallible function to each item
produced, stopping at the first error and returning that error. Read more
Source§fn zip<Right>(self, right: Right) -> Zip<Self, Right>
fn zip<Right>(self, right: Right) -> Zip<Self, Right>
Zips the output of two generators into a single generator of pairs. Read more
Source§fn dedup(self) -> Dedup<Self>
fn dedup(self) -> Dedup<Self>
Create a de-duplicating generator, removing consecutive duplicate values. Read more
Source§fn iter(self) -> IteratorAdaptor<Self> ⓘwhere
Self: Sized,
fn iter(self) -> IteratorAdaptor<Self> ⓘwhere
Self: Sized,
Create an iterator from a generator. Read more
Source§fn step_by(self, step_size: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step_size: usize) -> StepBy<Self>where
Self: Sized,
Create a generator that starts at the same point but steps by the given amount. Read more
Source§fn boxed(self) -> BoxedGenerator<Self::Output>where
Self: Sized + 'static,
fn boxed(self) -> BoxedGenerator<Self::Output>where
Self: Sized + 'static,
Available on crate feature
std
only.Box a generator, making it possible to use as return value in for instance traits. Read more
Source§fn sum<S>(self) -> S
fn sum<S>(self) -> S
Sums the values of a generator. Takes each value and adds them together and returns
the result. Read more
Source§fn product<P>(self) -> P
fn product<P>(self) -> P
Multiplies the values of a generator. Takes each value and adds them together and returns
the result. Read more
Source§fn min_by<F>(self, compare: F) -> Option<Self::Output>
fn min_by<F>(self, compare: F) -> Option<Self::Output>
Returns the value that gives the minimum value when compared with the
specified comparison function. Read more
Source§fn try_min_by<F>(
&mut self,
partial: Option<Self::Output>,
compare: F,
) -> TryReduction<Option<Self::Output>>
fn try_min_by<F>( &mut self, partial: Option<Self::Output>, compare: F, ) -> TryReduction<Option<Self::Output>>
Returns the value that gives the minimum value when compared with the
specified comparison function. Read more
Source§fn min_by_key<F, B>(self, f: F) -> Option<Self::Output>
fn min_by_key<F, B>(self, f: F) -> Option<Self::Output>
Returns the value that gives the minimum value from the specified function. Read more
Source§fn max_by<F>(self, compare: F) -> Option<Self::Output>
fn max_by<F>(self, compare: F) -> Option<Self::Output>
Returns the value that gives the maximum value when compared with the
specified comparison function. Read more
Source§fn try_max_by<F>(
&mut self,
partial: Option<Self::Output>,
compare: F,
) -> TryReduction<Option<Self::Output>>
fn try_max_by<F>( &mut self, partial: Option<Self::Output>, compare: F, ) -> TryReduction<Option<Self::Output>>
Returns the value that gives the maximum value when compared with the
specified comparison function. Read more
Source§fn max_by_key<F, B>(self, f: F) -> Option<Self::Output>
fn max_by_key<F, B>(self, f: F) -> Option<Self::Output>
Returns the value that gives the maximum value from the specified function. Read more
Source§fn fold<B, F>(self, init: B, folder: F) -> B
fn fold<B, F>(self, init: B, folder: F) -> B
Folds every element into an accumulator by applying an operation, returning the final result. Read more
Source§fn try_fold<B, F, E>(
&mut self,
init: B,
folder: F,
) -> Result<TryReduction<B>, E>
fn try_fold<B, F, E>( &mut self, init: B, folder: F, ) -> Result<TryReduction<B>, E>
Apply a function as long as the return value is successful, producing a single final value. Read more
Source§fn reduce<F>(self, reducer: F) -> Option<Self::Output>
fn reduce<F>(self, reducer: F) -> Option<Self::Output>
Reduces the elements to a single one by repeatedly applying a reducing operation. Read more
Source§fn try_reduce<F>(
&mut self,
prev_reduction: Option<Self::Output>,
reducer: F,
) -> TryReduction<Option<Self::Output>>
fn try_reduce<F>( &mut self, prev_reduction: Option<Self::Output>, reducer: F, ) -> TryReduction<Option<Self::Output>>
Reduces the values to a single value by repeatedly applying a reducing operation. Read more