Crate iia

source ·
Expand description

Collection of iterator adapter creation functions that act like their so-named Iterator method counterparts, but they take any instance of IntoIterator (which includes iterators and mutable references to them), allowing you to choose whether to call IntoIterator::into_iter or Iterator::by_ref explicitly.

Examples

use iia::chain;
let mut range = 0..10;
let mut iter = chain([1, 2, 3], &mut range);
iter.nth(5);
assert_eq!(range, 3..10);
use iia::rev;
for (i, j) in rev([1, 2, 3]).enumerate() {
    assert_eq!(i, 3 - j);
}

Functions