Struct Scan

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

An iterator to maintain state while iterating another iterator.

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

Fields

iter: I
f: F
state: St

Implementations

impl<I, St, F> Scan<I, St, F>

const fn new(iter: I, state: St, f: F) -> Scan<I, St, F>

Trait Implementations

impl<B, I, St, F> Iterator for Scan<I, St, F> where I: Iterator, F: FnMut(&mut St, I::Item) -> Option<B>,

type Item = B;
fn next(&mut self) -> Option<B>
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<AAA, FFF>(self, init: AAA, fold: FFF) -> AAA
where
    FFF: FnMut(AAA, Self::Item) -> AAA,

impl<I: Clone, St: Clone, F: Clone> Clone for Scan<I, St, F>

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

impl<I: Debug, St: Debug, F> Debug for Scan<I, St, F>

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

impl<St, F, I> SourceIter for Scan<I, St, F> where I: SourceIter,

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

impl<St, F, I: InPlaceIterable> InPlaceIterable for Scan<I, St, F>

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

Auto Trait Implementations

impl<I, St, F> Freeze for Scan<I, St, F> where I: Freeze, F: Freeze, St: Freeze,

impl<I, St, F> RefUnwindSafe for Scan<I, St, F> where I: RefUnwindSafe, F: RefUnwindSafe, St: RefUnwindSafe,

impl<I, St, F> Send for Scan<I, St, F> where I: Send, F: Send, St: Send,

impl<I, St, F> Sync for Scan<I, St, F> where I: Sync, F: Sync, St: Sync,

impl<I, St, F> Unpin for Scan<I, St, F> where I: Unpin, F: Unpin, St: Unpin,

impl<I, St, F> UnsafeUnpin for Scan<I, St, F> where I: UnsafeUnpin, F: UnsafeUnpin, St: UnsafeUnpin,

impl<I, St, F> UnwindSafe for Scan<I, St, F> where I: UnwindSafe, F: UnwindSafe, St: UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for Scan<I, St, F> where I: Iterator,

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

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

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

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

impl<T> From<T> for Scan<I, St, F>

fn from(t: T) -> T

Returns the argument unchanged.

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

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

impl<T> SizedTypeProperties for Scan<I, St, F>

impl<T, U> Into<U> for Scan<I, St, 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 Scan<I, St, 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 Scan<I, St, F> where U: TryFrom<T>,

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