pub trait IntoParIter: IntoConcurrentIter {
// Required method
fn into_par(self) -> Par<Self::IntoIter, DefaultRunner>;
}
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) -> Par<Self::IntoIter, DefaultRunner>
fn into_par(self) -> Par<Self::IntoIter, DefaultRunner>
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));