[][src]Struct pushback_iter::PushBackIterator

pub struct PushBackIterator<I: Iterator> { /* fields omitted */ }

An iterator with a push_back(item) method that allows items to be pushed back onto the iterator.

Implementations

impl<I: Iterator> PushBackIterator<I>[src]

pub fn push_back(&mut self, item: I::Item)[src]

Push back an item to the beginning of the iterator.

Items pushed back onto the iterator are returned from [next] in a last-in-first out basis.

pub fn peek(&mut self) -> Option<&I::Item>[src]

Returns a reference to the next() value without advancing the iterator.

Like [next], if there is a value, it is wrapped in a Some(T). But if the iteration is over, None is returned.

pub fn peek_nth(&mut self, n: usize) -> Option<&I::Item>[src]

Returns a reference to the nth(n) value without advancing the iterator.

Like [nth], if there is a value, it is wrapped in a Some(T). But if the iteration is over, None is returned.

pub fn reserve(&mut self, additional: usize)[src]

Reserves capacity for at least additional more elements in the push back buffer

Panics

Panics if the new capacity overflows usize.

pub fn shrink_to_fit(&mut self)[src]

Shrinks the capacity of the buffer as much as possible.

Trait Implementations

impl<I: Clone + Iterator> Clone for PushBackIterator<I> where
    I::Item: Clone
[src]

impl<I: Debug + Iterator> Debug for PushBackIterator<I> where
    I::Item: Debug
[src]

impl<I: DoubleEndedIterator> DoubleEndedIterator for PushBackIterator<I>[src]

impl<I: ExactSizeIterator> ExactSizeIterator for PushBackIterator<I>[src]

impl<I: Iterator> From<I> for PushBackIterator<I>[src]

impl<I: Iterator> Iterator for PushBackIterator<I>[src]

type Item = I::Item

The type of the elements being iterated over.

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.