Struct Iter

pub struct Iter<T> { /* private fields */ }

Parallel iterator over an inclusive range, implemented for all integer types and char.

Note: The zip operation requires IndexedParallelIterator which is only implemented for u8, i8, u16, i16, and char.

use rayon::prelude::*;

let p = (0..=25u16).into_par_iter()
                  .zip(0..=25u16)
                  .filter(|&(x, y)| x % 5 == 0 || y % 5 == 0)
                  .map(|(x, y)| x * y)
                  .sum::<u16>();

let s = (0..=25u16).zip(0..=25u16)
                  .filter(|&(x, y)| x % 5 == 0 || y % 5 == 0)
                  .map(|(x, y)| x * y)
                  .sum();

assert_eq!(p, s);

Trait Implementations

impl IndexedParallelIterator for Iter<char>

fn drive<C>(self, consumer: C) -> C::Result
where
    C: Consumer<Self::Item>,
fn len(&self) -> usize
fn with_producer<CB>(self, callback: CB) -> CB::Output
where
    CB: ProducerCallback<Self::Item>,

impl ParallelIterator for Iter<char>

type Item = char;
fn drive_unindexed<C>(self, consumer: C) -> C::Result
where
    C: UnindexedConsumer<Self::Item>,
fn opt_len(&self) -> Option<usize>

impl<T: Clone> Clone for Iter<T>

fn clone(&self) -> Self

impl<T: Debug> Debug for Iter<T>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<T: IndexedRangeInteger> IndexedParallelIterator for Iter<T>

fn drive<C>(self, consumer: C) -> C::Result
where
    C: Consumer<T>,
fn len(&self) -> usize
fn with_producer<CB>(self, callback: CB) -> CB::Output
where
    CB: ProducerCallback<T>,

impl<T: RangeInteger> ParallelIterator for Iter<T>

type Item = T;
fn drive_unindexed<C>(self, consumer: C) -> C::Result
where
    C: UnindexedConsumer<T>,
fn opt_len(&self) -> Option<usize>

Auto Trait Implementations

impl<T> Freeze for Iter<T> where RangeInclusive<T>: Freeze,

impl<T> RefUnwindSafe for Iter<T> where RangeInclusive<T>: RefUnwindSafe,

impl<T> Send for Iter<T> where RangeInclusive<T>: Send,

impl<T> Sync for Iter<T> where RangeInclusive<T>: Sync,

impl<T> Unpin for Iter<T> where RangeInclusive<T>: Unpin,

impl<T> UnsafeUnpin for Iter<T> where RangeInclusive<T>: UnsafeUnpin,

impl<T> UnwindSafe for Iter<T> where RangeInclusive<T>: UnwindSafe,

Blanket Implementations

impl<T> Any for Iter<T> where T: 'static + ?Sized,

impl<T> Borrow<T> for Iter<T> where T: ?Sized,

impl<T> BorrowMut<T> for Iter<T> where T: ?Sized,

impl<T> CloneToUninit for Iter<T> where T: Clone,

impl<T> From<T> for Iter<T>

impl<T> IntoEither for Iter<T>

impl<T> IntoParallelIterator for Iter<T> where T: ParallelIterator,

impl<T> Pointable for Iter<T>

impl<T> ToOwned for Iter<T> where T: Clone,

impl<T, U> Into<U> for Iter<T> where U: From<T>,

impl<T, U> TryFrom<U> for Iter<T> where U: Into<T>,

impl<T, U> TryInto<U> for Iter<T> where U: TryFrom<T>,