itermore
🤸♀️ More iterator adaptors.
This crate provides some useful iterator adaptors like array_chunks and
array_windows. Unlike itertools this
crate provides a separate extension trait for each adaptor. Additionally,
each type of adaptor is feature flagged so you only have to compile the
features you need.
Getting started
Add the crate to Cargo manifest.
And bring the extension traits into scope.
use *;
Now you can use extension methods like array_windows on any iterator.
for in iter.array_windows
// Outputs
// 1 2 3
// 2 3 4
// 3 4 5
It is recommended to only enable the features that you need, you can do this
by disabling all features and turning on the ones you want. For example if
you only want the array_combinations adaptor you would add the following
to your Cargo manifest.
[]
= { = "*", = false, = ["array_combinations"]}
Provided functionality
Methods
next_chunk: Returns the nextNelements of the iterator as an array.sortedand friends: Returns a new iterator with all elements sorted.
Adaptors
array_chunksreturns an iterator overNelements of the iterator at a time.array_windowsreturns an iterator over all contiguous windows of length `N.array_combinationsreturns an iterator overKlength combinations of all the elements in the underlying iterator.array_combinations_with_repsreturns an iterator overKlength combinations with repetitions/replacements of all the elements in the underlying iterator.
License
This project is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.