#peekable #iterator

fullypeek

Peek forward in an iterator as far as you'd like, memory allowing!

1 unstable release

0.1.0 Oct 15, 2023

#1502 in Rust patterns

MIT license

2.5MB
277 lines

fullypeek

Build Status Coverage Status Language

Peek forward in an iterator as far as you'd like, memory allowing!

El Chorro, Spain

let mut peekable = vec![1, 2, 3].into_iter().fully_peekable();

assert_eq!(peekable.peek(), Some(&1));
assert_eq!(peekable.peek_many(2), vec!(Some(&1), Some(&2)));

peekable.next();

assert_eq!(peekable.peek(), Some(&2));
assert_eq!(peekable.peek_many(2), vec!(Some(&2), Some(&3)));

peekable.next();

assert_eq!(peekable.peek(), Some(&3));
assert_eq!(peekable.peek_many(2), vec!(Some(&3), None));

lib.rs:

This crate contains an iterator which allows you to fully peek forward any number of elements.

No runtime deps