Trait IntoParallelIterator

trait IntoParallelIterator

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: TraitBound { trait_: Path { path: "ParallelIterator", id: Id(20), args: Some(AngleBracketed { args: [], constraints: [AssocItemConstraint { name: "Item", args: None, binding: Equality(Type(QualifiedPath { name: "Item", args: None, self_type: Generic("Self"), trait_: Some(Path { path: "", id: Id(23), args: None }) })) }] }) }, generic_params: [], modifier: None }

The parallel iterator type that will be created.

type Item: TraitBound { trait_: Path { path: "Send", id: Id(6), args: None }, generic_params: [], modifier: None }

The type of item that the parallel iterator will produce.

Required Methods

fn into_par_iter(self: Self) -> <Self as >::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)]);

Implementors