Crate itertools
Extra iterator adaptors, functions and macros.
To extend Iterator with methods in this crate, import
the Itertools trait:
#
use Itertools;
Now, new methods like interleave
are available on all iterators:
use Itertools;
let it = .interleave;
assert_equal;
Most iterator methods are also provided as functions (with the benefit
that they convert parameters using IntoIterator):
use interleave;
for elt in interleave
Crate Features
use_std- Enabled by default.
- Disable to compile itertools using
#![no_std]. This disables any item that depend on allocations (see theuse_allocfeature) and hash maps (likeunique,counts,into_grouping_mapand more).
use_alloc- Enabled by default.
- Enables any item that depend on allocations (like
chunk_by,kmerge,joinand many more).
Rust Version
This version of itertools requires Rust 1.63.0 or later.
Modules
Enums
-
FoldWhile
An enum used for controlling the execution of
fold_while.
Traits
Functions
-
assert_equal
Assert that two iterables produce equal sequences, with the same
semantics as
equal(a, b). -
equal
Return
trueif both iterables produce equal sequences (elements pairwise equal and sequences of the same length),falseotherwise. -
partition
Partition a sequence using predicate
predso that elements that map totrueare placed before elements which map tofalse.