Struct Inspect

#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Inspect<I, F> { pub(in ::iter::adapters::inspect) iter: I, pub(in ::iter::adapters::inspect) f: F }

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

This struct is created by the inspect method on Iterator. See its documentation for more.

Fields

iter: I
f: F

Implementations

impl<I, F> Inspect<I, F>

const fn new(iter: I, f: F) -> Inspect<I, F>

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

fn do_inspect(&mut self, elt: Option<I::Item>) -> Option<I::Item>

Trait Implementations

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

type Source = <I as SourceIter>::Source;
unsafe fn as_inner(&mut self) -> &mut I::Source

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

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

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

fn fmt(&self, f: &mut Formatter<'_>) -> Result

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

fn next_back(&mut self) -> Option<I::Item>
fn try_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> R
where
    Self: Sized,
    Fold: FnMut(Acc, Self::Item) -> R,
    R: Try<Output = Acc>,
fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Acc
where
    Fold: FnMut(Acc, Self::Item) -> Acc,

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

fn len(&self) -> usize
fn is_empty(&self) -> bool

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

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

const EXPAND_BY: Option<NonZero<usize>> = I::EXPAND_BY;
const MERGE_BY: Option<NonZero<usize>> = I::MERGE_BY;

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

type Item = <I as Iterator>::Item;
fn next(&mut self) -> Option<I::Item>
fn size_hint(&self) -> (usize, Option<usize>)
fn try_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> R
where
    Self: Sized,
    Fold: FnMut(Acc, Self::Item) -> R,
    R: Try<Output = Acc>,
fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Acc
where
    Fold: FnMut(Acc, Self::Item) -> Acc,

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

Auto Trait Implementations

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

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

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

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

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

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

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

Blanket Implementations

impl<I> IntoIterator for Inspect<I, F> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

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

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Inspect<I, F> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Inspect<I, F> where T: ?Sized,

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

impl<T> CloneToUninit for Inspect<I, F> where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Inspect<I, F>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for Inspect<I, F> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Inspect<I, F>

impl<T, U> Into<U> for Inspect<I, F> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom<U> for Inspect<I, F> where U: Into<T>,

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

impl<T, U> TryInto<U> for Inspect<I, F> where U: TryFrom<T>,

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