Crate itertools [−] [src]
Itertools — extra iterator adaptors, functions and macros.
To use the iterator methods in this crate, import the Itertools trait:
use itertools::Itertools;
Some iterators or adaptors are used directly like regular structs, for example
PutBack, Unfold,
Zip, Stride
To enable the macros in this crate, use the #[macro_use] attribute:
#[macro_use] extern crate itertools;
License
Dual-licensed to be compatible with the Rust project.
Licensed under the Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0 or the MIT license http://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.
Reexports
pub use free::enumerate; |
pub use free::rev; |
Modules
| free |
Free functions that create iterator adaptors or call iterator methods. |
| misc |
A module of helper traits and iterators that are not intended to be used directly. |
| size_hint |
Arithmetic on Iterator .size_hint() values. |
Macros
| iproduct |
Create an iterator over the “cartesian product” of iterators. |
| izip |
Create an iterator running multiple iterators in lockstep. |
Structs
| Batching |
A “meta iterator adaptor”. Its closure recives a reference to the iterator and may pick off as many elements as it likes, to produce the next iterator element. |
| Chunk |
An iterator for the elements in a single chunk. |
| Chunks |
An iterator that yields the Chunk iterators. |
| ChunksLazy |
|
| Coalesce |
An iterator adaptor that may join together adjacent elements. |
| Combinations |
An iterator to iterate through all the combinations of pairs in a |
| CombinationsN |
An iterator to iterate through all the |
| Dedup |
An iterator adaptor that removes repeated duplicates. |
| Flatten |
An iterator adapter to simply flatten a structure. |
| Format |
Format all iterator elements lazily, separated by |
| FormatDefault |
Format all iterator elements lazily, separated by |
| Group |
An iterator for the elements in a single group. |
| GroupBy |
An iterator adaptor that groups iterator elements. Consecutive elements that map to the same key (“runs”), are returned as the iterator elements. |
| GroupByLazy |
|
| Groups |
An iterator that yields the Group iterators. |
| ISlice |
An iterator adaptor that yields a subset (a slice) of the base iterator. |
| Interleave |
An iterator adaptor that alternates elements from two iterators until both run out. |
| InterleaveShortest |
An iterator adaptor that alternates elements from the two iterators until one of them runs out. |
| Intersperse |
An iterator adaptor to insert a particular value between each element of the adapted iterator. |
| KMerge |
An iterator adaptor that merges an abitrary number of base iterators in ascending order. If all base iterators are sorted (ascending), the result is sorted. |
| Linspace |
An iterator of a sequence of evenly spaced floats. |
| MendSlices |
An iterator adaptor that glues together adjacent contiguous slices. |
| Merge |
An iterator adaptor that merges the two base iterators in ascending order. If both base iterators are sorted (ascending), the result is sorted. |
| MergeBy |
An iterator adaptor that merges the two base iterators in ascending order. If both base iterators are sorted (ascending), the result is sorted. |
| MultiPeek |
An iterator adaptor that allows the user to peek at multiple |
| PadUsing |
An iterator adaptor that pads a sequence to a minimum length by filling missing elements using a closure. |
| Product |
An iterator adaptor that iterates over the cartesian product of
the element sets of two iterators |
| PutBack |
An iterator adaptor that allows putting back a single item to the front of the iterator. |
| PutBackN |
An iterator adaptor that allows putting multiple items in front of the iterator. |
| RcIter |
A wrapper for |
| RepeatCall |
An iterator source that produces elements indefinitely by calling a given closure. |
| RepeatN |
An iterator that repeats an element exactly n times. |
| Step |
An iterator adaptor that steps a number elements in the base iterator for each iteration. |
| Stride |
An iterator similar to the slice iterator, but with a certain number of steps (the stride) skipped per iteration. |
| StrideMut |
The mutable equivalent of Stride. |
| TakeWhileRef |
An iterator adaptor that borrows from a |
| Tee |
One half of an iterator pair where both return the same elements. |
| Unfold |
|
| Unique |
An iterator adapter to filter out duplicate elements. |
| UniqueBy |
An iterator adapter to filter out duplicate elements. |
| WhileSome |
An iterator adaptor that filters |
| Zip |
An iterator that generalizes .zip() and allows running multiple iterators in lockstep. |
| ZipEq |
An iterator which iterates two other iterators simultaneously |
| ZipLongest |
An iterator which iterates two other iterators simultaneously |
| ZipSlices |
An iterator which iterates two slices simultaneously. |
Enums
| Diff |
A type returned by the |
| EitherOrBoth |
A value yielded by |
| FoldWhile |
An enum used for controlling the execution of |
| MinMaxResult |
|
| Partition |
Classifies the result of the |
Traits
| Itertools |
The trait |
Functions
| assert_equal |
Assert that two iterators produce equal sequences, with the same semantics as equal(a, b). |
| diff_with |
Compares every element yielded by both |
| equal |
Return |
| linspace |
Return an iterator of evenly spaced floats. |
| partition |
Partition a sequence using predicate |
Type Definitions
| MapFn |
The function pointer map iterator created with |