maybe_parallel_iterator
Write your code once. Then toggle between sequential and parallel iterators with a feature flag!
let a: = .collect;
a.into_maybe_parallel_iterator
.with_min_sequential
.map
.enumerate
.flat_map
.for_each
Features
- Iterators
into_maybe_par_itermaybe_par_itermaybe_par_iter_mut
- Sorts
maybe_par_sortmaybe_par_sort_unstablemaybe_par_sort_bymaybe_par_sort_unstable_bymaybe_par_sort_by_keymaybe_par_sort_unstable_by_key
Use the rayon feature flag to enable rayon parallelism.
The default is sequential ("rayoff" mode).
Limitations
For now, only supports these iterator adapters:
collect- *
enumerate filter_mapfind_anyflat_mapfor_eachmap- *
with_min_sequential(no-op unlessrayonfeature enabled)
*Only available for IndexedParallelIterator's if rayon feature enabled.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.