Trait PeekingNext

trait PeekingNext: Iterator

An iterator that allows peeking at an element before deciding to accept it.

See .peeking_take_while() for more information.

This is implemented by peeking adaptors like peekable and put back, but also by a few iterators that can be peeked natively, like the slice’s by reference iterator (std::slice::Iter).

Required Methods

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

Pass a reference to the next iterator element to the closure accept; if accept returns true, return it as the next element, else None.

Implementors