Struct PutBack

#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub struct PutBack<I>
where
    I: Iterator, { /* private fields */ }

An iterator adaptor that allows putting back a single item to the front of the iterator.

Iterator element type is I::Item.

Implementations

impl<I> PutBack<I> where I: Iterator,

fn with_value(self, value: I::Item) -> Self

put back value value (builder method)

fn into_parts(self) -> (Option<I::Item>, I)

Split the PutBack into its parts.

fn put_back(&mut self, x: I::Item) -> Option<I::Item>

Put back a single value to the front of the iterator.

If a value is already in the put back slot, it is returned.

Trait Implementations

impl<I> Clone for PutBack<I> where I: Iterator + Clone, I::Item: Clone,

fn clone(&self) -> PutBack<I>

impl<I> Debug for PutBack<I> where I: Iterator + Debug, I::Item: Debug,

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

impl<I> Iterator for PutBack<I> where I: Iterator,

type Item = <I as Iterator>::Item;
fn next(&mut self) -> Option<Self::Item>
fn size_hint(&self) -> (usize, Option<usize>)
fn count(self) -> usize
fn last(self) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
fn all<G>(&mut self, f: G) -> bool
where
    G: FnMut(Self::Item) -> bool,
fn fold<Acc, G>(self, init: Acc, f: G) -> Acc
where
    G: FnMut(Acc, Self::Item) -> Acc,

impl<I> PeekingNext for PutBack<I> where I: Iterator,

fn peeking_next<F>(&mut self, accept: F) -> Option<Self::Item>
where
    F: FnOnce(&Self::Item) -> bool,

Auto Trait Implementations

impl<I> Freeze for PutBack<I> where Option<<I as Iterator>::Item>: Freeze, I: Freeze,

impl<I> RefUnwindSafe for PutBack<I> where Option<<I as Iterator>::Item>: RefUnwindSafe, I: RefUnwindSafe,

impl<I> Send for PutBack<I> where Option<<I as Iterator>::Item>: Send, I: Send,

impl<I> Sync for PutBack<I> where Option<<I as Iterator>::Item>: Sync, I: Sync,

impl<I> Unpin for PutBack<I> where Option<<I as Iterator>::Item>: Unpin, I: Unpin,

impl<I> UnsafeUnpin for PutBack<I> where Option<<I as Iterator>::Item>: UnsafeUnpin, I: UnsafeUnpin,

impl<I> UnwindSafe for PutBack<I> where Option<<I as Iterator>::Item>: UnwindSafe, I: UnwindSafe,

Blanket Implementations

impl<I> IntoIterator for PutBack<I> where I: Iterator,

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

impl<IT> MultiUnzip<()> for PutBack<I> where IT: Iterator<Item = ()>,

fn multiunzip(self)

impl<IT, A, FromA> MultiUnzip<(FromA,)> for PutBack<I> where IT: Iterator<Item = (A,)>, FromA: Default + Extend<A>,

fn multiunzip(self) -> (FromA,)

impl<IT, A, FromA, B, FromB> MultiUnzip<(FromA, FromB)> for PutBack<I> where IT: Iterator<Item = (A, B)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>,

fn multiunzip(self) -> (FromA, FromB)

impl<IT, A, FromA, B, FromB, C, FromC> MultiUnzip<(FromA, FromB, FromC)> for PutBack<I> where IT: Iterator<Item = (A, B, C)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>, FromC: Default + Extend<C>,

fn multiunzip(self) -> (FromA, FromB, FromC)

impl<IT, A, FromA, B, FromB, C, FromC, D, FromD> MultiUnzip<(FromA, FromB, FromC, FromD)> for PutBack<I> where IT: Iterator<Item = (A, B, C, D)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>, FromC: Default + Extend<C>, FromD: Default + Extend<D>,

fn multiunzip(self) -> (FromA, FromB, FromC, FromD)

impl<IT, A, FromA, B, FromB, C, FromC, D, FromD, E, FromE> MultiUnzip<(FromA, FromB, FromC, FromD, FromE)> for PutBack<I> where IT: Iterator<Item = (A, B, C, D, E)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>, FromC: Default + Extend<C>, FromD: Default + Extend<D>, FromE: Default + Extend<E>,

fn multiunzip(self) -> (FromA, FromB, FromC, FromD, FromE)

impl<IT, A, FromA, B, FromB, C, FromC, D, FromD, E, FromE, F, FromF> MultiUnzip<(FromA, FromB, FromC, FromD, FromE, FromF)> for PutBack<I> where IT: Iterator<Item = (A, B, C, D, E, F)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>, FromC: Default + Extend<C>, FromD: Default + Extend<D>, FromE: Default + Extend<E>, FromF: Default + Extend<F>,

fn multiunzip(self) -> (FromA, FromB, FromC, FromD, FromE, FromF)

impl<IT, A, FromA, B, FromB, C, FromC, D, FromD, E, FromE, F, FromF, G, FromG> MultiUnzip<(FromA, FromB, FromC, FromD, FromE, FromF, FromG)> for PutBack<I> where IT: Iterator<Item = (A, B, C, D, E, F, G)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>, FromC: Default + Extend<C>, FromD: Default + Extend<D>, FromE: Default + Extend<E>, FromF: Default + Extend<F>, FromG: Default + Extend<G>,

fn multiunzip(self) -> (FromA, FromB, FromC, FromD, FromE, FromF, FromG)

impl<IT, A, FromA, B, FromB, C, FromC, D, FromD, E, FromE, F, FromF, G, FromG, H, FromH> MultiUnzip<(FromA, FromB, FromC, FromD, FromE, FromF, FromG, FromH)> for PutBack<I> where IT: Iterator<Item = (A, B, C, D, E, F, G, H)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>, FromC: Default + Extend<C>, FromD: Default + Extend<D>, FromE: Default + Extend<E>, FromF: Default + Extend<F>, FromG: Default + Extend<G>, FromH: Default + Extend<H>,

fn multiunzip(self) -> (FromA, FromB, FromC, FromD, FromE, FromF, FromG, FromH)

impl<IT, A, FromA, B, FromB, C, FromC, D, FromD, E, FromE, F, FromF, G, FromG, H, FromH, I, FromI> MultiUnzip<(FromA, FromB, FromC, FromD, FromE, FromF, FromG, FromH, FromI)> for PutBack<I> where IT: Iterator<Item = (A, B, C, D, E, F, G, H, I)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>, FromC: Default + Extend<C>, FromD: Default + Extend<D>, FromE: Default + Extend<E>, FromF: Default + Extend<F>, FromG: Default + Extend<G>, FromH: Default + Extend<H>, FromI: Default + Extend<I>,

fn multiunzip(self) -> (FromA, FromB, FromC, FromD, FromE, FromF, FromG, FromH, FromI)

impl<IT, A, FromA, B, FromB, C, FromC, D, FromD, E, FromE, F, FromF, G, FromG, H, FromH, I, FromI, J, FromJ> MultiUnzip<(FromA, FromB, FromC, FromD, FromE, FromF, FromG, FromH, FromI, FromJ)> for PutBack<I> where IT: Iterator<Item = (A, B, C, D, E, F, G, H, I, J)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>, FromC: Default + Extend<C>, FromD: Default + Extend<D>, FromE: Default + Extend<E>, FromF: Default + Extend<F>, FromG: Default + Extend<G>, FromH: Default + Extend<H>, FromI: Default + Extend<I>, FromJ: Default + Extend<J>,

fn multiunzip(self) -> (FromA, FromB, FromC, FromD, FromE, FromF, FromG, FromH, FromI, FromJ)

impl<IT, A, FromA, B, FromB, C, FromC, D, FromD, E, FromE, F, FromF, G, FromG, H, FromH, I, FromI, J, FromJ, K, FromK> MultiUnzip<(FromA, FromB, FromC, FromD, FromE, FromF, FromG, FromH, FromI, FromJ, FromK)> for PutBack<I> where IT: Iterator<Item = (A, B, C, D, E, F, G, H, I, J, K)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>, FromC: Default + Extend<C>, FromD: Default + Extend<D>, FromE: Default + Extend<E>, FromF: Default + Extend<F>, FromG: Default + Extend<G>, FromH: Default + Extend<H>, FromI: Default + Extend<I>, FromJ: Default + Extend<J>, FromK: Default + Extend<K>,

fn multiunzip(self) -> (FromA, FromB, FromC, FromD, FromE, FromF, FromG, FromH, FromI, FromJ, FromK)

impl<IT, A, FromA, B, FromB, C, FromC, D, FromD, E, FromE, F, FromF, G, FromG, H, FromH, I, FromI, J, FromJ, K, FromK, L, FromL> MultiUnzip<(FromA, FromB, FromC, FromD, FromE, FromF, FromG, FromH, FromI, FromJ, FromK, FromL)> for PutBack<I> where IT: Iterator<Item = (A, B, C, D, E, F, G, H, I, J, K, L)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>, FromC: Default + Extend<C>, FromD: Default + Extend<D>, FromE: Default + Extend<E>, FromF: Default + Extend<F>, FromG: Default + Extend<G>, FromH: Default + Extend<H>, FromI: Default + Extend<I>, FromJ: Default + Extend<J>, FromK: Default + Extend<K>, FromL: Default + Extend<L>,

fn multiunzip(self) -> (FromA, FromB, FromC, FromD, FromE, FromF, FromG, FromH, FromI, FromJ, FromK, FromL)

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

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

impl<T> CloneToUninit for PutBack<I> where T: Clone,

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

impl<T> From<T> for PutBack<I>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> IntoEither for PutBack<I>

impl<T> Itertools for PutBack<I> where T: Iterator + ?Sized,

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for PutBack<I> 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 PutBack<I> where U: Into<T>,

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

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

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