devela::all

Trait IteratorPeekingNext

pub trait IteratorPeekingNext: Iterator {
    // Required method
    fn peeking_next<F>(&mut self, accept: F) -> Option<Self::Item> ⓘ
       where Self: Sized,
             F: FnOnce(&Self::Item) -> bool;
}
Available on crate feature dep_itertools only.
Expand description

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

Re-exported from the itertools crate PeekingNext→IteratorPeekingNext.


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

Implementations on Foreign Types§

§

impl<I> PeekingNext for &mut I
where I: PeekingNext,

§

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

Implementors§

§

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

§

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

§

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

§

impl<'a, T> PeekingNext for devela::_core::option::Iter<'a, T>

§

impl<'a, T> PeekingNext for devela::_core::result::Iter<'a, T>

§

impl<'a, T> PeekingNext for devela::_core::slice::Iter<'a, T>

§

impl<'a, T> PeekingNext for devela::_dep::_alloc::collections::linked_list::Iter<'a, T>

§

impl<'a, T> PeekingNext for devela::_dep::_alloc::collections::vec_deque::Iter<'a, T>

§

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

§

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

§

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

§

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

§

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

§

impl<I> PeekingNext for Rev<I>

§

impl<I, F> PeekingNext for PeekingTakeWhile<'_, I, F>
where I: PeekingNext, F: FnMut(&<I as Iterator>::Item) -> bool,

§

impl<T> PeekingNext for RepeatN<T>
where T: Clone,

§

impl<T> PeekingNext for Empty<T>