Expand description
Parallel iteration where the target has threads, sequential where it does not.
rayon is a native-only dependency: Cargo.toml already keeps it under
cfg(not(target_arch = "wasm32")). The browser build compiles for wasm32,
where there is no thread pool, so the fifteen par_iter and into_par_iter
call sites resolve to the sequential stand-in below instead.
Everything downstream of those two calls is unchanged: the chains are map,
filter, enumerate and collect, all of which behave identically on a
std iterator. The wasm32 build therefore computes the same answer, serially.
The hash folds inside the map closures were already plain iterator folds,
so nothing about the results changes.
Traits§
- From
Parallel Iterator FromParallelIteratorimplements the creation of a collection from aParallelIterator. By implementingFromParallelIteratorfor a given type, you define how it will be created from an iterator.- Indexed
Parallel Iterator - An iterator that supports “random access” to its data, meaning that you can split it at arbitrary indices and draw data from those points.
- Into
Parallel Iterator IntoParallelIteratorimplements the conversion to aParallelIterator.- Into
Parallel RefIterator IntoParallelRefIteratorimplements the conversion to aParallelIterator, providing shared references to the data.- Into
Parallel RefMut Iterator IntoParallelRefMutIteratorimplements the conversion to aParallelIterator, providing mutable references to the data.- Parallel
Bridge - Conversion trait to convert an
Iteratorto aParallelIterator. - Parallel
Drain Full ParallelDrainFullcreates a parallel iterator that moves all items from a collection while retaining the original capacity.- Parallel
Drain Range ParallelDrainRangecreates a parallel iterator that moves a range of items from a collection while retaining the original capacity.- Parallel
Extend ParallelExtendextends an existing collection with items from aParallelIterator.- Parallel
Iterator - Parallel version of the standard iterator trait.
- Parallel
Slice - Parallel extensions for slices.
- Parallel
Slice Mut - Parallel extensions for mutable slices.
- Parallel
String - Parallel extensions for strings.