Trait rayon::iter::IntoParallelIterator
source · pub trait IntoParallelIterator {
type Iter: ParallelIterator<Item = Self::Item>;
type Item: Send;
// 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<Item = Self::Item>
type Iter: ParallelIterator<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 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)]);
Implementations on Foreign Types§
source§impl<'a, A, B, C, D, E, F, G, H, I, J, K> IntoParallelIterator for &'a mut (A, B, C, D, E, F, G, H, I, J, K)where
A: IntoParallelRefMutIterator<'a>,
A::Iter: IndexedParallelIterator,
B: IntoParallelRefMutIterator<'a>,
B::Iter: IndexedParallelIterator,
C: IntoParallelRefMutIterator<'a>,
C::Iter: IndexedParallelIterator,
D: IntoParallelRefMutIterator<'a>,
D::Iter: IndexedParallelIterator,
E: IntoParallelRefMutIterator<'a>,
E::Iter: IndexedParallelIterator,
F: IntoParallelRefMutIterator<'a>,
F::Iter: IndexedParallelIterator,
G: IntoParallelRefMutIterator<'a>,
G::Iter: IndexedParallelIterator,
H: IntoParallelRefMutIterator<'a>,
H::Iter: IndexedParallelIterator,
I: IntoParallelRefMutIterator<'a>,
I::Iter: IndexedParallelIterator,
J: IntoParallelRefMutIterator<'a>,
J::Iter: IndexedParallelIterator,
K: IntoParallelRefMutIterator<'a>,
K::Iter: IndexedParallelIterator,
impl<'a, A, B, C, D, E, F, G, H, I, J, K> IntoParallelIterator for &'a mut (A, B, C, D, E, F, G, H, I, J, K)where A: IntoParallelRefMutIterator<'a>, A::Iter: IndexedParallelIterator, B: IntoParallelRefMutIterator<'a>, B::Iter: IndexedParallelIterator, C: IntoParallelRefMutIterator<'a>, C::Iter: IndexedParallelIterator, D: IntoParallelRefMutIterator<'a>, D::Iter: IndexedParallelIterator, E: IntoParallelRefMutIterator<'a>, E::Iter: IndexedParallelIterator, F: IntoParallelRefMutIterator<'a>, F::Iter: IndexedParallelIterator, G: IntoParallelRefMutIterator<'a>, G::Iter: IndexedParallelIterator, H: IntoParallelRefMutIterator<'a>, H::Iter: IndexedParallelIterator, I: IntoParallelRefMutIterator<'a>, I::Iter: IndexedParallelIterator, J: IntoParallelRefMutIterator<'a>, J::Iter: IndexedParallelIterator, K: IntoParallelRefMutIterator<'a>, K::Iter: IndexedParallelIterator,
type Item = (<A as IntoParallelRefMutIterator<'a>>::Item, <B as IntoParallelRefMutIterator<'a>>::Item, <C as IntoParallelRefMutIterator<'a>>::Item, <D as IntoParallelRefMutIterator<'a>>::Item, <E as IntoParallelRefMutIterator<'a>>::Item, <F as IntoParallelRefMutIterator<'a>>::Item, <G as IntoParallelRefMutIterator<'a>>::Item, <H as IntoParallelRefMutIterator<'a>>::Item, <I as IntoParallelRefMutIterator<'a>>::Item, <J as IntoParallelRefMutIterator<'a>>::Item, <K as IntoParallelRefMutIterator<'a>>::Item)
type Iter = MultiZip<(<A as IntoParallelRefMutIterator<'a>>::Iter, <B as IntoParallelRefMutIterator<'a>>::Iter, <C as IntoParallelRefMutIterator<'a>>::Iter, <D as IntoParallelRefMutIterator<'a>>::Iter, <E as IntoParallelRefMutIterator<'a>>::Iter, <F as IntoParallelRefMutIterator<'a>>::Iter, <G as IntoParallelRefMutIterator<'a>>::Iter, <H as IntoParallelRefMutIterator<'a>>::Iter, <I as IntoParallelRefMutIterator<'a>>::Iter, <J as IntoParallelRefMutIterator<'a>>::Iter, <K as IntoParallelRefMutIterator<'a>>::Iter)>
fn into_par_iter(self) -> Self::Iter
source§impl<A> IntoParallelIterator for (A,)where
A: IntoParallelIterator,
A::Iter: IndexedParallelIterator,
impl<A> IntoParallelIterator for (A,)where A: IntoParallelIterator, A::Iter: IndexedParallelIterator,
type Item = (<A as IntoParallelIterator>::Item,)
type Iter = MultiZip<(<A as IntoParallelIterator>::Iter,)>
fn into_par_iter(self) -> Self::Iter
source§impl<T> IntoParallelIterator for Range<T>where
Iter<T>: ParallelIterator,
impl<T> IntoParallelIterator for Range<T>where Iter<T>: ParallelIterator,
Implemented for ranges of all primitive integer types and char
.
source§impl<'a, T: Sync> IntoParallelIterator for &'a Option<T>
impl<'a, T: Sync> IntoParallelIterator for &'a Option<T>
source§impl<T: Ord + Send> IntoParallelIterator for BinaryHeap<T>
impl<T: Ord + Send> IntoParallelIterator for BinaryHeap<T>
source§impl<T> IntoParallelIterator for RangeInclusive<T>where
Iter<T>: ParallelIterator,
impl<T> IntoParallelIterator for RangeInclusive<T>where Iter<T>: ParallelIterator,
Implemented for ranges of all primitive integer types and char
.