pub trait DoubleEndedStreamingIterator: StreamingIterator {
    // Required method
    fn advance_back(&mut self);

    // Provided methods
    fn next_back(&mut self) -> Option<&Self::Item> { ... }
    fn rfold<B, F>(self, init: B, f: F) -> B
       where Self: Sized,
             F: FnMut(B, &Self::Item) -> B { ... }
}
Expand description

A streaming iterator able to yield elements from both ends.

Required Methods§

source

fn advance_back(&mut self)

Advances the iterator to the next element from the back of the iterator.

Double ended iterators just after the last element, so this should be called before get when iterating in reverse.

The behavior of calling this method after the iterator has been exhausted is unspecified.

Provided Methods§

source

fn next_back(&mut self) -> Option<&Self::Item>

Advances the iterator and returns the next value from the back.

The behavior of calling this method after the iterator has been exhausted is unspecified.

The default implementation simply calls advance_back followed by get.

source

fn rfold<B, F>(self, init: B, f: F) -> Bwhere Self: Sized, F: FnMut(B, &Self::Item) -> B,

Reduces the iterator’s elements to a single, final value, starting from the back.

Implementors§