Struct PutBackN
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
pub struct PutBackN<I: Iterator> { /* private fields */ }
An iterator adaptor that allows putting multiple items in front of the iterator.
Iterator element type is I::Item.
Implementations
impl<I: Iterator> PutBackN<I>
fn put_back(&mut self, x: I::Item)Puts
xin front of the iterator.The values are yielded in order of the most recently put back values first.
use itertools::put_back_n; let mut it = put_back_n(1..5); it.next(); it.put_back(1); it.put_back(0); assert!(itertools::equal(it, 0..5));
Trait Implementations
impl<I> PeekingNext for PutBackN<I>
where
I: Iterator,
fn peeking_next<F>(&mut self, accept: F) -> Option<Self::Item> where F: FnOnce(&Self::Item) -> bool,
impl<I: Clone + Iterator> Clone for PutBackN<I>
where
I::Item: Clone,
fn clone(&self) -> Self
impl<I: Debug + Iterator> Debug for PutBackN<I>
where
I::Item: Debug,
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<I: Iterator> Iterator for PutBackN<I>
type Item = <I as Iterator>::Item;fn next(&mut self) -> Option<Self::Item>fn size_hint(&self) -> (usize, Option<usize>)fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B,