pub struct SliceParallelSource<'data, T> { /* private fields */ }Expand description
A parallel source over a slice. This struct is created by the
par_iter() method on
IntoExactParallelRefSource.
You most likely won’t need to interact with this struct directly, as it
implements the ExactParallelSource and
ExactParallelSourceExt traits, but it is
nonetheless public because of the must_use annotation.
See also MutSliceParallelSource.
let input = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let iter: SliceParallelSource<_> = input.par_iter();
let sum = iter.with_thread_pool(&mut thread_pool).sum::<i32>();
assert_eq!(sum, 5 * 11);Trait Implementations§
Source§impl<'data, T: Sync> ExactParallelSource for SliceParallelSource<'data, T>
impl<'data, T: Sync> ExactParallelSource for SliceParallelSource<'data, T>
Auto Trait Implementations§
impl<'data, T> Freeze for SliceParallelSource<'data, T>
impl<'data, T> RefUnwindSafe for SliceParallelSource<'data, T>where
T: RefUnwindSafe,
impl<'data, T> Send for SliceParallelSource<'data, T>where
T: Sync,
impl<'data, T> Sync for SliceParallelSource<'data, T>where
T: Sync,
impl<'data, T> Unpin for SliceParallelSource<'data, T>
impl<'data, T> UnwindSafe for SliceParallelSource<'data, T>where
T: RefUnwindSafe,
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
Source§impl<T> ExactParallelSourceExt for Twhere
T: ExactParallelSource,
impl<T> ExactParallelSourceExt for Twhere
T: ExactParallelSource,
Source§fn chain<T: ExactParallelSource<Item = Self::Item>>(
self,
next: T,
) -> Chain<Self, T>
fn chain<T: ExactParallelSource<Item = Self::Item>>( self, next: T, ) -> Chain<Self, T>
Returns a parallel source that produces items from this source followed
by items from the next source. Read more
Source§fn enumerate(self) -> Enumerate<Self>
fn enumerate(self) -> Enumerate<Self>
Returns a parallel source that produces pairs of (index, item) for the
items of this source. Read more
Source§fn rev(self) -> Rev<Self>
fn rev(self) -> Rev<Self>
Returns a parallel source that produces items from this source in
reverse order. Read more
Source§fn skip(self, n: usize) -> Skip<Self>
fn skip(self, n: usize) -> Skip<Self>
Returns a parallel source that skips the first
n items from this
source, or all the items if this source has fewer than n items, and
produces the remaining items. Read moreSource§fn skip_exact(self, n: usize) -> SkipExact<Self>
fn skip_exact(self, n: usize) -> SkipExact<Self>
Returns a parallel source that skips the first
n items from this
source, panicking if this source has fewer than n items, and produces
the remaining items. Read moreSource§fn step_by(self, n: usize) -> StepBy<Self>
fn step_by(self, n: usize) -> StepBy<Self>
Returns a parallel source that produces every
n-th item from this
source, starting with the first one. Read moreSource§fn take(self, n: usize) -> Take<Self>
fn take(self, n: usize) -> Take<Self>
Returns a parallel source that produces the first
n items from this
source, or all the items if this source has fewer than n items. Read moreSource§fn take_exact(self, n: usize) -> TakeExact<Self>
fn take_exact(self, n: usize) -> TakeExact<Self>
Returns a parallel source that produces the first
n items from this
source, panicking if this source has fewer than n items. Read moreSource§fn with_thread_pool<T: GenericThreadPool>(
self,
thread_pool: T,
) -> BaseExactParallelIterator<T, Self>
fn with_thread_pool<T: GenericThreadPool>( self, thread_pool: T, ) -> BaseExactParallelIterator<T, Self>
Attaches the given
GenericThreadPool to this ExactParallelSource
and obtain a ParallelIterator. Read more