pub trait IntoParallelIterator<'a> {
type Iter: ParallelIterator<'a, Item = Self::Item>;
type Item: Send + 'a;
// Required method
fn into_par_iter(self) -> Self::Iter;
}Expand description
IntoParallelIterator implements the conversion to a ParallelIterator.
By implementing IntoParallelIterator for a type, you define how it will
transformed into an iterator. This is a parallel version of the standard
library’s std::iter::IntoIterator trait.
Required Associated Types§
Sourcetype Iter: ParallelIterator<'a, Item = Self::Item>
type Iter: ParallelIterator<'a, Item = Self::Item>
The parallel iterator type that will be created.
Required Methods§
Sourcefn into_par_iter(self) -> Self::Iter
fn into_par_iter(self) -> Self::Iter
Converts self into a parallel iterator.
§Examples
use asparit::*;
println!("counting in parallel:");
(0..100)
.into_par_iter()
.for_each(|i| println!("{}", i))
.exec();This conversion is often implicit for arguments to methods like zip.
use asparit::*;
let v: Vec<_> = (0..5).into_par_iter().zip(5..10).collect().exec();
assert_eq!(v, [(0, 5), (1, 6), (2, 7), (3, 8), (4, 9)]);