Struct std::iter::Peekable

pub struct Peekable<A, T> {
    priv iter: T,
    priv peeked: Option<A>,
}

An iterator with a peek() that returns an optional reference to the next element.

Methods

impl<'self, A, T: Iterator<A>> Peekable<A, T>

fn peek(&'self mut self) -> Option<&'self A>

Return a reference to the next element of the iterator with out advancing it, or None if the iterator is exhausted.

Trait Implementations

impl<A, T: Iterator<A>> Iterator<A> for Peekable<A, T>

fn next(&mut self) -> Option<A>

Advance the iterator and return the next value. Return None when the end is reached.

fn size_hint(&self) -> (uint, Option<uint>)

Return a lower bound and upper bound on the remaining length of the iterator.

The common use case for the estimate is pre-allocating space to store the results.