pub trait MaybeParIter {
type Item;
type ParIter: ParallelIterator<Item = Self::Item>;
type Iter: Iterator<Item = Self::Item>;
// Required method
fn maybe_par_iter(
self,
parallel: bool,
) -> MaybeParallel<Self::ParIter, Self::Iter>;
}Expand description
Trait which allows use of Rayon parallelism to be conditionally enabled.
See https://crates.io/crates/rayon-cond for a more full-featured alternative.
Required Associated Types§
type Item
type ParIter: ParallelIterator<Item = Self::Item>
type Iter: Iterator<Item = Self::Item>
Required Methods§
Sourcefn maybe_par_iter(
self,
parallel: bool,
) -> MaybeParallel<Self::ParIter, Self::Iter>
fn maybe_par_iter( self, parallel: bool, ) -> MaybeParallel<Self::ParIter, Self::Iter>
Return an iterator which executes either in serial on the current
thread, or in parallel in a Rayon thread pool if parallel is true.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".