Struct Iter

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

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

Note: The zip operation requires IndexedParallelIterator which is not implemented for u64, i64, u128, or i128.

use rayon::prelude::*;

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

let s = (0..25usize).zip(0..25)
                  .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 Range<T>: Freeze,

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

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

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

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

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

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

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

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

fn borrow_mut(&mut self) -> &mut T

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

unsafe fn clone_to_uninit(&self, dest: *mut u8)

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

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> IntoEither for Iter<T>

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

type Iter = T;
type Item = <T as ParallelIterator>::Item;
fn into_par_iter(self) -> T

impl<T> Pointable for Iter<T>

const ALIGN: usize = _;
type Init = T;
unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

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

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

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

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

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

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>