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

The parallel iterator type that will be created.

The type of item that the parallel iterator will produce.

Required methods

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

This implementation requires const generics, stabilized in Rust 1.51.

This implementation requires const generics, stabilized in Rust 1.51.

This implementation requires const generics, stabilized in Rust 1.51.

Implemented for ranges of all primitive integer types and char.

Implemented for ranges of all primitive integer types and char.

Implementors