itertools

Trait PeekingNext

Source
pub trait PeekingNext: Iterator {
    // Required method
    fn peeking_next<F>(&mut self, accept: F) -> Option<Self::Item>
       where F: FnOnce(&Self::Item) -> bool;
}
Expand description

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§

Source

fn peeking_next<F>(&mut self, accept: F) -> Option<Self::Item>
where F: FnOnce(&Self::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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'a> PeekingNext for Bytes<'a>

Source§

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

Source§

impl<'a> PeekingNext for CharIndices<'a>

Source§

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

Source§

impl<'a> PeekingNext for Chars<'a>

Source§

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

Source§

impl<'a, T> PeekingNext for Iter<'a, T>

Source§

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

Source§

impl<'a, T> PeekingNext for Iter<'a, T>

Source§

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

Source§

impl<'a, T> PeekingNext for Iter<'a, T>

Source§

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

Source§

impl<'a, T> PeekingNext for Iter<'a, T>

Source§

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

Source§

impl<'a, T> PeekingNext for Iter<'a, T>

Source§

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

Source§

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

Source§

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

Source§

impl<I: Clone + PeekingNext + DoubleEndedIterator> PeekingNext for Rev<I>

Source§

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

Source§

impl<T> PeekingNext for Empty<T>

Source§

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

Implementors§

Source§

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

Source§

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

Source§

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