Skip to main content

VecParallelSink

Struct VecParallelSink 

Source
pub struct VecParallelSink<T>
where T: Send,
{ /* private fields */ }
Expand description

A parallel sink towards a Vec. This struct is consumed by the finalize() method on FromExactParallelSink.

You most likely won’t need to interact with this struct directly, as it implements the ExactParallelSink trait, but it is nonetheless public as it is an associated type of FromExactParallelSink for Vec and similar collections.

let vec: Vec<_> = (1..=10)
    .into_par_iter()
    .with_thread_pool(&mut thread_pool)
    .collect();
assert_eq!(vec, vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);

The element type must be Send, so the following example doesn’t compile.

ⓘ
use std::rc::Rc;

let vec: Vec<Rc<_>> = (1..=10)
    .into_par_iter()
    .map(Rc::new)
    .with_thread_pool(&mut thread_pool)
    .collect();

Trait Implementations§

Source§

impl<T> ExactParallelSink for VecParallelSink<T>
where T: Send,

Source§

const NEEDS_CLEANUP: bool

Set to false if the skip function is guaranteed to be a noop. Read more
Source§

type Item = T

The type of items that this parallel sink collects.
Source§

fn new(len: usize) -> VecParallelSink<T>

Creates a new sink able to collect the given number of items.
Source§

unsafe fn push_item( &self, index: usize, item: <VecParallelSink<T> as ExactParallelSink>::Item, )

Pushes the given item at the given index of this sink. Read more
Source§

unsafe fn skip_item_range(&self, range: Range<usize>)

Indicates that the items in the given range won’t be pushed. Read more
Source§

unsafe fn cancel(self)

Cancel and cleanup this sink. Read more

Auto Trait Implementations§

§

impl<T> !Freeze for VecParallelSink<T>

§

impl<T> !Send for VecParallelSink<T>

§

impl<T> RefUnwindSafe for VecParallelSink<T>
where MutPtrWrapper<T>: RefUnwindSafe,

§

impl<T> Sync for VecParallelSink<T>
where MutPtrWrapper<T>: Sync,

§

impl<T> Unpin for VecParallelSink<T>
where MutPtrWrapper<T>: Unpin,

§

impl<T> UnsafeUnpin for VecParallelSink<T>
where MutPtrWrapper<T>: UnsafeUnpin,

§

impl<T> UnwindSafe for VecParallelSink<T>
where MutPtrWrapper<T>: UnwindSafe,

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.