pub struct Inspect<I, F> { /* private fields */ }
Expand description

An iterator that calls a function with a reference to each element before yielding it.

Trait Implementations§

source§

impl<I: Clone, F: Clone> Clone for Inspect<I, F>

source§

fn clone(&self) -> Inspect<I, F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I, F> InternalIterator for Inspect<I, F>
where I: InternalIterator, F: FnMut(&I::Item),

§

type Item = <I as InternalIterator>::Item

Type of items yielded by the iterator.
source§

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 more
source§

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) -> bool
where F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches the predicate. Read more
source§

fn any<F>(self, f: F) -> bool
where 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>,

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,

Creates an iterator yields cloned elements of the original iterator. Read more
source§

fn collect<B>(self) -> B
where 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,

Creates an iterator yields copied elements of the original iterator. Read more
source§

fn count(self) -> usize

Returns the number of elements yielded by the iterator. Read more
source§

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,

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>,

source§

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,

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) -> B
where F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, returning the final result. Read more
source§

fn for_each<F>(self, f: F)
where F: FnMut(Self::Item),

Run the closure on each element.
source§

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 last(self) -> Option<Self::Item>

Returns the last element. Read more
source§

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,

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>

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,

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>

Returns the element that gives the minimum value from the specified function.
source§

fn next(self) -> Option<Self::Item>

Returns the first element of the iterator. Read more
source§

fn nth(self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
source§

fn position<F>(self, f: F) -> Option<usize>
where F: FnMut(Self::Item) -> bool,

Returns the index of the first element matching the predicate. Read more
source§

fn skip(self, n: usize) -> Skip<Self>

Skip first n elements of the iterator. Read more
source§

fn take(self, n: usize) -> Take<Self>

Take first n elements of the iterator, disregarding the rest. Read more

Auto Trait Implementations§

§

impl<I, F> RefUnwindSafe for Inspect<I, F>

§

impl<I, F> Send for Inspect<I, F>
where F: Send, I: Send,

§

impl<I, F> Sync for Inspect<I, F>
where F: Sync, I: Sync,

§

impl<I, F> Unpin for Inspect<I, F>
where F: Unpin, I: Unpin,

§

impl<I, F> UnwindSafe for Inspect<I, F>
where F: UnwindSafe, I: 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<I> IntoInternalIterator for I

§

type Item = <I as InternalIterator>::Item

The type of the elements being iterated over.
§

type IntoIter = I

Concrete iterator type returned by the conversion.
source§

fn into_internal_iter(self) -> <I as IntoInternalIterator>::IntoIter

Convert this type to an internal iterator.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.