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,
impl<T> ExactParallelSink for VecParallelSink<T>where
T: Send,
Source§const NEEDS_CLEANUP: bool
const NEEDS_CLEANUP: bool
Source§fn new(len: usize) -> VecParallelSink<T>
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,
)
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
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more