Struct internal_iterator::FilterMap
source · pub struct FilterMap<I, F> { /* private fields */ }
Expand description
An iterator that uses f
to both filter and map elements from iter
.
Trait Implementations§
source§impl<I, F, T> InternalIterator for FilterMap<I, F>where
I: InternalIterator,
F: FnMut(I::Item) -> Option<T>,
impl<I, F, T> InternalIterator for FilterMap<I, F>where I: InternalIterator, F: FnMut(I::Item) -> Option<T>,
source§fn try_for_each<R, C>(self, consumer: C) -> ControlFlow<R>where
C: FnMut(Self::Item) -> ControlFlow<R>,
fn try_for_each<R, C>(self, consumer: C) -> ControlFlow<R>where C: FnMut(Self::Item) -> ControlFlow<R>,
Applies function each elements of the iterator. Stops early if the
function returns
ControlFlow::Break
. Read moresource§fn find_map<R, F>(self, f: F) -> Option<R>where
F: FnMut(Self::Item) -> Option<R>,
fn find_map<R, F>(self, f: F) -> Option<R>where F: FnMut(Self::Item) -> Option<R>,
Applies function to the elements of iterator and returns the first
non-none result. Read more
source§fn all<F>(self, f: F) -> boolwhere
F: FnMut(Self::Item) -> bool,
fn all<F>(self, f: F) -> boolwhere F: FnMut(Self::Item) -> bool,
Tests if every element of the iterator matches the predicate. Read more
source§fn any<F>(self, f: F) -> boolwhere
F: FnMut(Self::Item) -> bool,
fn any<F>(self, f: F) -> boolwhere F: FnMut(Self::Item) -> bool,
Tests if any element of the iterator matches the predicate. Read more
source§fn chain<U>(
self,
other: U
) -> Chain<Self, <U as IntoInternalIterator>::IntoIter>where
U: IntoInternalIterator<Item = Self::Item>,
fn chain<U>( self, other: U ) -> Chain<Self, <U as IntoInternalIterator>::IntoIter>where U: IntoInternalIterator<Item = Self::Item>,
Takes two iterators and returns an iterator that first iterates over the
elements of the first iterator, and then over the second one. Read more
source§fn cloned<'a, T>(self) -> Cloned<Self>where
Self: InternalIterator<Item = &'a T>,
T: Clone + 'a,
fn cloned<'a, T>(self) -> Cloned<Self>where Self: InternalIterator<Item = &'a T>, T: Clone + 'a,
Creates an iterator yields cloned elements of the original iterator. Read more
source§fn collect<B>(self) -> Bwhere
B: FromInternalIterator<Self::Item>,
fn collect<B>(self) -> Bwhere B: FromInternalIterator<Self::Item>,
Transforms the iterator into a collection. Read more
source§fn copied<'a, T>(self) -> Copied<Self>where
Self: InternalIterator<Item = &'a T>,
T: Copy + 'a,
fn copied<'a, T>(self) -> Copied<Self>where Self: InternalIterator<Item = &'a T>, T: Copy + 'a,
Creates an iterator yields copied elements of the original iterator. Read more
source§fn enumerate(self) -> Enumerate<Self>
fn enumerate(self) -> Enumerate<Self>
Creates an iterator that adds the index to every value of the original
iterator. Read more
source§fn filter<P>(self, predicate: P) -> Filter<Self, P>where
P: FnMut(&Self::Item) -> bool,
fn filter<P>(self, predicate: P) -> Filter<Self, P>where P: FnMut(&Self::Item) -> bool,
Creates an iterator which only yields elements matching the predicate. Read more
source§fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>where
F: FnMut(Self::Item) -> Option<T>,
fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>where F: FnMut(Self::Item) -> Option<T>,
source§fn find<F>(self, f: F) -> Option<Self::Item>where
F: FnMut(&Self::Item) -> bool,
fn find<F>(self, f: F) -> Option<Self::Item>where F: FnMut(&Self::Item) -> bool,
Returns the first element of the iterator that matches the predicate. Read more
source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, F>where
F: FnMut(Self::Item) -> U,
U: IntoInternalIterator,
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, F>where F: FnMut(Self::Item) -> U, U: IntoInternalIterator,
Creates and iterator which maps over the elements and flattens the
resulting structure. Read more
source§fn fold<B, F>(self, init: B, f: F) -> Bwhere
F: FnMut(B, Self::Item) -> B,
fn fold<B, F>(self, init: B, f: F) -> Bwhere F: FnMut(B, Self::Item) -> B,
Folds every element into an accumulator by applying an operation, returning the final result. Read more
source§fn inspect<F>(self, f: F) -> Inspect<Self, F>where
F: FnMut(&Self::Item),
fn inspect<F>(self, f: F) -> Inspect<Self, F>where F: FnMut(&Self::Item),
Run the closure on each element, while passing that element on. Read more
source§fn map<F, T>(self, f: F) -> Map<Self, F>where
F: FnMut(Self::Item) -> T,
fn map<F, T>(self, f: F) -> Map<Self, F>where F: FnMut(Self::Item) -> T,
Transform each element in the iterator. Read more
source§fn max_by<F>(self, compare: F) -> Option<Self::Item>where
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
fn max_by<F>(self, compare: F) -> Option<Self::Item>where F: FnMut(&Self::Item, &Self::Item) -> Ordering,
Returns the maximum element of an iterator using a custom comparer
function.
source§fn max_by_key<B: Ord>(
self,
key: impl FnMut(&Self::Item) -> B
) -> Option<Self::Item>
fn max_by_key<B: Ord>( self, key: impl FnMut(&Self::Item) -> B ) -> Option<Self::Item>
Returns the element that gives the maximum value from the specified function.
source§fn min_by<F>(self, compare: F) -> Option<Self::Item>where
F: FnMut(&Self::Item, &Self::Item) -> Ordering,
fn min_by<F>(self, compare: F) -> Option<Self::Item>where F: FnMut(&Self::Item, &Self::Item) -> Ordering,
Returns the minimum element of an iterator using a custom comparer
function.
source§fn min_by_key<B: Ord>(
self,
key: impl FnMut(&Self::Item) -> B
) -> Option<Self::Item>
fn min_by_key<B: Ord>( self, key: impl FnMut(&Self::Item) -> B ) -> Option<Self::Item>
Returns the element that gives the minimum value from the specified function.
source§fn nth(self, n: usize) -> Option<Self::Item>
fn nth(self, n: usize) -> Option<Self::Item>
Returns the
n
th element of the iterator. Read moreAuto Trait Implementations§
impl<I, F> RefUnwindSafe for FilterMap<I, F>where F: RefUnwindSafe, I: RefUnwindSafe,
impl<I, F> Send for FilterMap<I, F>where F: Send, I: Send,
impl<I, F> Sync for FilterMap<I, F>where F: Sync, I: Sync,
impl<I, F> Unpin for FilterMap<I, F>where F: Unpin, I: Unpin,
impl<I, F> UnwindSafe for FilterMap<I, F>where 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
source§impl<I> IntoInternalIterator for Iwhere
I: InternalIterator,
impl<I> IntoInternalIterator for Iwhere I: InternalIterator,
§type Item = <I as InternalIterator>::Item
type Item = <I as InternalIterator>::Item
The type of the elements being iterated over.
source§fn into_internal_iter(self) -> <I as IntoInternalIterator>::IntoIter
fn into_internal_iter(self) -> <I as IntoInternalIterator>::IntoIter
Convert this type to an internal iterator.