3 unstable releases
0.2.1 | Dec 25, 2019 |
---|---|
0.2.0 | Feb 18, 2019 |
0.1.0 | Feb 18, 2019 |
#1210 in Rust patterns
Used in 3 crates
(via flumedb)
10KB
198 lines
Bidrectional iterators
use bidir_iter::*;
let a: &[i64] = &[1, 2, 3];
let mut iter = a.bidir_iter();
assert_eq!(iter.next(), Some(&1));
assert_eq!(iter.next(), Some(&2));
assert_eq!(iter.next(), Some(&3));
assert_eq!(iter.prev(), Some(&2));
assert_eq!(iter.prev(), Some(&1));
assert_eq!(iter.prev(), None);
assert_eq!(iter.next(), Some(&1));