pub trait IntoParIter: IntoConcurrentIter {
// Required method
fn into_par(self) -> impl ParIter<DefaultRunner, Item = Self::Item>;
}
Expand description
Trait to convert a source (collection or generator) into a parallel iterator; i.e., ParIter
,
using its into_par
method.
It can be considered as the concurrent counterpart of the IntoIterator
trait.
Note that every IntoConcurrentIter
type automatically implements IntoParIter
.
§Examples
use orx_parallel::*;
// Vec<T>: IntoParIter<Item = T>
let vec = vec![1, 2, 3, 4];
assert_eq!(vec.into_par().max(), Some(4));
// Range<T>: IntoParIter<Item = T>
let range = 1..5;
assert_eq!(range.into_par().max(), Some(4));
Required Methods§
Sourcefn into_par(self) -> impl ParIter<DefaultRunner, Item = Self::Item>
fn into_par(self) -> impl ParIter<DefaultRunner, Item = Self::Item>
Trait to convert a source (collection or generator) into a parallel iterator; i.e., ParIter
,
using its into_par
method.
It can be considered as the concurrent counterpart of the IntoIterator
trait.
§Examples
use orx_parallel::*;
// Vec<T>: IntoParIter<Item = T>
let vec = vec![1, 2, 3, 4];
assert_eq!(vec.into_par().max(), Some(4));
// Range<T>: IntoParIter<Item = T>
let range = 1..5;
assert_eq!(range.into_par().max(), Some(4));
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.