peeking_iter/lib.rs
1//! A fast and simple iterator adapter that allows peeking with any depth:
2//!
3//! ```rust
4//! use peeking_iter::peeking::*;
5//!
6//! fn main() {
7//! let mut it = PeekingIter::new(0..=2);
8//!
9//! assert_eq!(it.next(), Some(0));
10//! assert_eq!(it.peek(), Some(1));
11//! assert_eq!(it.peek(), Some(2));
12//! assert_eq!(it.next(), Some(1));
13//! assert_eq!(it.peek(), Some(2));
14//! assert_eq!(it.peek(), None);
15//! }
16//! ```
17//!
18//! # Why?
19//! - ~1.5x faster than itertools' `MultiPeek`
20//! - Has useful methods initially designed with lexing and parsing in mind (see `Parser`)
21
22pub mod parser;
23pub mod peeking;