Crate itertools

Extra iterator adaptors, functions and macros.

To extend Iterator with methods in this crate, import the Itertools trait:

# #[allow(unused_imports)]
use itertools::Itertools;

Now, new methods like interleave are available on all iterators:

use itertools::Itertools;

let it = (1..3).interleave(vec![-1, -2]);
itertools::assert_equal(it, vec![1, -1, 2, -2]);

Most iterator methods are also provided as functions (with the benefit that they convert parameters using IntoIterator):

use itertools::interleave;

for elt in interleave(&[1, 2, 3], &[2, 3, 4]) {
    /* loop body */
    # let _ = elt;
}

Crate Features

Rust Version

This version of itertools requires Rust 1.63.0 or later.

Modules

Enums

Traits

Functions

Macros