Trait rustc_rayon::iter::IntoParallelIterator [−][src]
pub trait IntoParallelIterator {
type Iter: ParallelIterator<Item = Self::Item>;
type Item: Send;
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.
Associated Types
type Iter: ParallelIterator<Item = Self::Item>
type Iter: ParallelIterator<Item = Self::Item>
The parallel iterator type that will be created.
Required methods
fn into_par_iter(self) -> Self::Iter
fn into_par_iter(self) -> Self::Iter
Converts self
into a parallel iterator.
Examples
use rayon::prelude::*;
println!("counting in parallel:");
(0..100).into_par_iter()
.for_each(|i| println!("{}", i));
This conversion is often implicit for arguments to methods like zip
.
use rayon::prelude::*;
let v: Vec<_> = (0..5).into_par_iter().zip(5..10).collect();
assert_eq!(v, [(0, 5), (1, 6), (2, 7), (3, 8), (4, 9)]);