Skip to content

Releases: clintval/fullypeek

0.1.01

15 Oct 05:11
ab80cd5
Compare
Choose a tag to compare
0.1.01 Pre-release
Pre-release

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

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));