Crates.io | bidir_iter |
lib.rs | bidir_iter |
version | 0.2.1 |
source | src |
created_at | 2019-02-18 06:19:39.438459 |
updated_at | 2019-12-25 07:10:22.870612 |
description | Bidirectional iterators |
homepage | |
repository | https://github.com/sbillig/bidir_iter |
max_upload_size | |
id | 115510 |
size | 21,755 |
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));