itertools

Function peek_nth

Source
pub fn peek_nth<I>(iterable: I) -> PeekNth<I::IntoIter> 
where I: IntoIterator,
Expand description

A drop-in replacement for std::iter::Peekable which adds a peek_nth method allowing the user to peek at a value several iterations forward without advancing the base iterator.

This differs from multipeek in that subsequent calls to peek or peek_nth will always return the same value until next is called (making reset_peek unnecessary).