Crates.io | fullypeek |
lib.rs | fullypeek |
version | 0.1.0 |
source | src |
created_at | 2023-10-15 05:09:54.302473 |
updated_at | 2023-10-15 05:09:54.302473 |
description | Peek forward in an iterator as far as you'd like, memory allowing! |
homepage | |
repository | https://github.com/clintval/fullypeek |
max_upload_size | |
id | 1003497 |
size | 2,326,525 |
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));