3 releases
0.1.2 | Apr 24, 2023 |
---|---|
0.1.1 | Apr 24, 2023 |
0.1.0 | Apr 24, 2023 |
#451 in No standard library
33 downloads per month
7KB
105 lines
IntoIterator
-enabled iterator adapter creation functions.
This library is free software, you can use and re-use it under the terms of the MIT license. A copy of the license is provided in the source repository in the “LICENSE” file.
lib.rs
:
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);
}