Struct streaming_iterator::FilterMap
source · pub struct FilterMap<I, B, F> { /* private fields */ }
Expand description
An iterator which both filters and maps elements of a streaming iterator with a closure.
Trait Implementations§
source§impl<I, B, F> DoubleEndedStreamingIterator for FilterMap<I, B, F>where
I: DoubleEndedStreamingIterator,
F: FnMut(&I::Item) -> Option<B>,
impl<I, B, F> DoubleEndedStreamingIterator for FilterMap<I, B, F>where I: DoubleEndedStreamingIterator, F: FnMut(&I::Item) -> Option<B>,
source§fn advance_back(&mut self)
fn advance_back(&mut self)
Advances the iterator to the next element from the back of the iterator. Read more
source§impl<I, B, F> DoubleEndedStreamingIteratorMut for FilterMap<I, B, F>where
I: DoubleEndedStreamingIterator,
F: FnMut(&I::Item) -> Option<B>,
impl<I, B, F> DoubleEndedStreamingIteratorMut for FilterMap<I, B, F>where I: DoubleEndedStreamingIterator, F: FnMut(&I::Item) -> Option<B>,
source§impl<I, B, F> StreamingIterator for FilterMap<I, B, F>where
I: StreamingIterator,
F: FnMut(&I::Item) -> Option<B>,
impl<I, B, F> StreamingIterator for FilterMap<I, B, F>where I: StreamingIterator, F: FnMut(&I::Item) -> Option<B>,
source§fn get(&self) -> Option<&B>
fn get(&self) -> Option<&B>
Returns a reference to the current element of the iterator. Read more
source§fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator.
source§fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere
Self: Sized,
Fold: FnMut(Acc, &Self::Item) -> Acc,
fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Self: Sized, Fold: FnMut(Acc, &Self::Item) -> Acc,
Reduces the iterator’s elements to a single, final value.
source§fn next(&mut self) -> Option<&Self::Item>
fn next(&mut self) -> Option<&Self::Item>
Advances the iterator and returns the next value. Read more
source§fn all<F>(&mut self, f: F) -> boolwhere
Self: Sized,
F: FnMut(&Self::Item) -> bool,
fn all<F>(&mut self, f: F) -> boolwhere Self: Sized, F: FnMut(&Self::Item) -> bool,
Determines if all elements of the iterator satisfy a predicate.
source§fn any<F>(&mut self, f: F) -> boolwhere
Self: Sized,
F: FnMut(&Self::Item) -> bool,
fn any<F>(&mut self, f: F) -> boolwhere Self: Sized, F: FnMut(&Self::Item) -> bool,
Determines if any elements of the iterator satisfy a predicate.
source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere Self: Sized,
Borrows an iterator, rather than consuming it. Read more
source§fn chain<I>(self, other: I) -> Chain<Self, I>where
Self: Sized,
I: StreamingIterator<Item = Self::Item> + Sized,
fn chain<I>(self, other: I) -> Chain<Self, I>where Self: Sized, I: StreamingIterator<Item = Self::Item> + Sized,
Consumes two iterators and returns a new iterator that iterates over both in sequence.
source§fn count(self) -> usizewhere
Self: Sized,
fn count(self) -> usizewhere Self: Sized,
Consumes the iterator, counting the number of remaining elements and returning it.
source§fn filter<F>(self, f: F) -> Filter<Self, F>where
Self: Sized,
F: FnMut(&Self::Item) -> bool,
fn filter<F>(self, f: F) -> Filter<Self, F>where Self: Sized, F: FnMut(&Self::Item) -> bool,
Creates an iterator which uses a closure to determine if an element should be yielded.
source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, B, F>where
Self: Sized,
F: FnMut(&Self::Item) -> Option<B>,
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, B, F>where Self: Sized, F: FnMut(&Self::Item) -> Option<B>,
Creates an iterator which both filters and maps by applying a closure to elements.
source§fn flat_map<J, F>(self, f: F) -> FlatMap<Self, J, F>where
Self: Sized,
J: StreamingIterator,
F: FnMut(&Self::Item) -> J,
fn flat_map<J, F>(self, f: F) -> FlatMap<Self, J, F>where Self: Sized, J: StreamingIterator, F: FnMut(&Self::Item) -> J,
Creates an iterator which flattens iterators obtained by applying a closure to elements.
Note that the returned iterators must be streaming iterators.
source§fn filter_map_deref<B, F>(self, f: F) -> FilterMapDeref<Self, F> ⓘwhere
Self: Sized,
F: FnMut(&Self::Item) -> Option<B>,
fn filter_map_deref<B, F>(self, f: F) -> FilterMapDeref<Self, F> ⓘwhere Self: Sized, F: FnMut(&Self::Item) -> Option<B>,
Creates a regular, non-streaming iterator which both filters and maps by applying a closure to elements.
source§fn find<F>(&mut self, f: F) -> Option<&Self::Item>where
Self: Sized,
F: FnMut(&Self::Item) -> bool,
fn find<F>(&mut self, f: F) -> Option<&Self::Item>where Self: Sized, F: FnMut(&Self::Item) -> bool,
Returns the first element of the iterator that satisfies the predicate.
source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where Self: Sized,
Creates an iterator which is “well behaved” at the beginning and end of iteration. Read more
source§fn inspect<F>(self, f: F) -> Inspect<Self, F>where
F: FnMut(&Self::Item),
Self: Sized,
fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: FnMut(&Self::Item), Self: Sized,
Call a closure on each element, passing the element on.
The closure is called upon calls to
advance
or advance_back
, and exactly once per element
regardless of how many times (if any) get
is called.source§fn map<B, F>(self, f: F) -> Map<Self, B, F>where
Self: Sized,
F: FnMut(&Self::Item) -> B,
fn map<B, F>(self, f: F) -> Map<Self, B, F>where Self: Sized, F: FnMut(&Self::Item) -> B,
Creates an iterator which transforms elements of this iterator by passing them to a closure.
source§fn map_deref<B, F>(self, f: F) -> MapDeref<Self, F> ⓘwhere
Self: Sized,
F: FnMut(&Self::Item) -> B,
fn map_deref<B, F>(self, f: F) -> MapDeref<Self, F> ⓘwhere Self: Sized, F: FnMut(&Self::Item) -> B,
Creates a regular, non-streaming iterator which transforms elements of this iterator by passing them to a closure.
source§fn map_ref<B: ?Sized, F>(self, f: F) -> MapRef<Self, F>where
Self: Sized,
F: Fn(&Self::Item) -> &B,
fn map_ref<B: ?Sized, F>(self, f: F) -> MapRef<Self, F>where Self: Sized, F: Fn(&Self::Item) -> &B,
Creates an iterator which transforms elements of this iterator by passing them to a closure. Read more
source§fn nth(&mut self, n: usize) -> Option<&Self::Item>
fn nth(&mut self, n: usize) -> Option<&Self::Item>
Consumes the first
n
elements of the iterator, returning the next one.source§fn position<F>(&mut self, f: F) -> Option<usize>where
Self: Sized,
F: FnMut(&Self::Item) -> bool,
fn position<F>(&mut self, f: F) -> Option<usize>where Self: Sized, F: FnMut(&Self::Item) -> bool,
Returns the index of the first element of the iterator matching a predicate.
source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where Self: Sized,
Creates an iterator which skips the first
n
elements.source§fn skip_while<F>(self, f: F) -> SkipWhile<Self, F>where
Self: Sized,
F: FnMut(&Self::Item) -> bool,
fn skip_while<F>(self, f: F) -> SkipWhile<Self, F>where Self: Sized, F: FnMut(&Self::Item) -> bool,
Creates an iterator that skips initial elements matching a predicate.
source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where Self: Sized,
Creates an iterator which only returns the first
n
elements.source§impl<I, B, F> StreamingIteratorMut for FilterMap<I, B, F>where
I: StreamingIterator,
F: FnMut(&I::Item) -> Option<B>,
impl<I, B, F> StreamingIteratorMut for FilterMap<I, B, F>where I: StreamingIterator, F: FnMut(&I::Item) -> Option<B>,
source§fn get_mut(&mut self) -> Option<&mut B>
fn get_mut(&mut self) -> Option<&mut B>
Returns a mutable reference to the current element of the iterator. Read more
source§fn fold_mut<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere
Self: Sized,
Fold: FnMut(Acc, &mut Self::Item) -> Acc,
fn fold_mut<Acc, Fold>(self, init: Acc, fold: Fold) -> Accwhere Self: Sized, Fold: FnMut(Acc, &mut Self::Item) -> Acc,
Reduces the iterator’s mutable elements to a single, final value.
source§fn next_mut(&mut self) -> Option<&mut Self::Item>
fn next_mut(&mut self) -> Option<&mut Self::Item>
Advances the iterator and returns the next mutable value. Read more
source§fn for_each_mut<F>(self, f: F)where
Self: Sized,
F: FnMut(&mut Self::Item),
fn for_each_mut<F>(self, f: F)where Self: Sized, F: FnMut(&mut Self::Item),
Calls a closure on each mutable element of an iterator.
source§fn map_deref_mut<B, F>(self, f: F) -> MapDerefMut<Self, F> ⓘwhere
Self: Sized,
F: FnMut(&mut Self::Item) -> B,
fn map_deref_mut<B, F>(self, f: F) -> MapDerefMut<Self, F> ⓘwhere Self: Sized, F: FnMut(&mut Self::Item) -> B,
Creates a regular, non-streaming iterator which transforms mutable elements
of this iterator by passing them to a closure.
Auto Trait Implementations§
impl<I, B, F> RefUnwindSafe for FilterMap<I, B, F>where B: RefUnwindSafe, F: RefUnwindSafe, I: RefUnwindSafe,
impl<I, B, F> Send for FilterMap<I, B, F>where B: Send, F: Send, I: Send,
impl<I, B, F> Sync for FilterMap<I, B, F>where B: Sync, F: Sync, I: Sync,
impl<I, B, F> Unpin for FilterMap<I, B, F>where B: Unpin, F: Unpin, I: Unpin,
impl<I, B, F> UnwindSafe for FilterMap<I, B, F>where B: UnwindSafe, F: UnwindSafe, I: 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