Skip to main content

ParRef

Struct ParRef 

Source
pub struct ParRef<'a, T, P> { /* private fields */ }
Expand description

A read-only parallel view of a slice bound to execution policy P.

Construct via ParallelSlice::par. Zero-sized beyond the borrowed slice.

Implementations§

Source§

impl<'a, T, P: ExecutionPolicy> ParRef<'a, T, P>

Source

pub fn for_each<F: Fn(&T) + Send + Sync>(self, f: F)
where T: Sync,

Apply f to every element. See for_each_with.

Source

pub fn enumerate<F: Fn(usize, &T) + Send + Sync>(self, f: F)
where T: Sync,

Apply f(index, &element) to every element. See enumerate_with.

Source

pub fn map_collect<R: Send, F: Fn(&T) -> R + Send + Sync>(self, f: F) -> Vec<R>
where T: Sync,

Map then collect into a Vec<R> in order. See map_collect_with.

Source

pub fn map_collect_index<R: Send, F: Fn(usize, &T) -> R + Send + Sync>( self, f: F, ) -> Vec<R>
where T: Sync,

Map each (index, &element) pair, then collect into a Vec<R> in order.

This is the indexed counterpart to Self::map_collect. It exposes the logical slice index without requiring callers to derive it from pointers.

Source

pub fn map_reduce<R, M, Rd>(self, identity: R, map: M, reduce: Rd) -> R
where T: Sync, R: Send + Sync + Clone, M: Fn(&T) -> R + Send + Sync, Rd: Fn(R, R) -> R + Send + Sync,

Map-reduce. See map_reduce_with.

Auto Trait Implementations§

§

impl<'a, T, P> Freeze for ParRef<'a, T, P>
where &'a [T]: Freeze, PhantomData<P>: Freeze,

§

impl<'a, T, P> RefUnwindSafe for ParRef<'a, T, P>

§

impl<'a, T, P> Send for ParRef<'a, T, P>
where &'a [T]: Send, PhantomData<P>: Send,

§

impl<'a, T, P> Sync for ParRef<'a, T, P>
where &'a [T]: Sync, PhantomData<P>: Sync,

§

impl<'a, T, P> Unpin for ParRef<'a, T, P>
where &'a [T]: Unpin, PhantomData<P>: Unpin,

§

impl<'a, T, P> UnsafeUnpin for ParRef<'a, T, P>

§

impl<'a, T, P> UnwindSafe for ParRef<'a, T, P>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.