pub trait ConcurrentSlice<T> {
// Provided methods
fn concurrent_split_at(
self,
index: usize,
) -> (Chunk<Self, T>, Chunk<Self, T>)
where Self: 'static + AsMut<[T]> + Sized + Send,
T: 'static + Send { ... }
fn concurrent_chunks(self, chunk_size: usize) -> Chunks<Self, T> ⓘ
where Self: 'static + AsMut<[T]> + Sized + Send,
T: 'static + Send { ... }
fn concurrent_chunks_by_division(
self,
division: impl Into<Option<usize>>,
) -> Chunks<Self, T> ⓘ
where Self: 'static + AsMut<[T]> + Sized + Send,
T: 'static + Send { ... }
fn owning_iter(self) -> Iter<Self, T> ⓘ
where Self: 'static + Send + Deref + CloneStableAddress,
Self::Target: AsRef<[T]> { ... }
fn owning_windows(self, size: usize) -> Windows<Self, T> ⓘ
where Self: 'static + Send + Deref + CloneStableAddress,
Self::Target: AsRef<[T]> { ... }
}Expand description
The trait adds methods for concurrent processing on any type that can be borrowed as a slice.
Provided Methods§
Sourcefn concurrent_split_at(self, index: usize) -> (Chunk<Self, T>, Chunk<Self, T>)
fn concurrent_split_at(self, index: usize) -> (Chunk<Self, T>, Chunk<Self, T>)
Splits the slice-like data into two sub-slices, divided at specified index.
§Panics
The method panics if the index is out of bound.
Sourcefn concurrent_chunks(self, chunk_size: usize) -> Chunks<Self, T> ⓘ
fn concurrent_chunks(self, chunk_size: usize) -> Chunks<Self, T> ⓘ
Returns an iterator of roughly fixed-sized chunks of the slice.
Each chunk has chunk_size elements, expect the last chunk maybe shorter
if there aren’t enough elements.
The yielded chunks maintain a global reference count. Each chunk refers to a mutable and exclusive sub-slice, enabling concurrent processing on input data.
§Panics
The method panics if chunk_size is zero and slice length is not zero.
Sourcefn concurrent_chunks_by_division(
self,
division: impl Into<Option<usize>>,
) -> Chunks<Self, T> ⓘ
fn concurrent_chunks_by_division( self, division: impl Into<Option<usize>>, ) -> Chunks<Self, T> ⓘ
Returns an iterator with roughly division length of roughly fixed-sized chunks of the slice.
The chunk size is determined by division. The last chunk maybe shorter if
there aren’t enough elements. If division is None, it defaults to
the number of system processors.
§Panics
The method panics if division is zero and slice length is not zero.
Sourcefn owning_iter(self) -> Iter<Self, T> ⓘ
fn owning_iter(self) -> Iter<Self, T> ⓘ
Returns an iterator of owned references to each element of the slice.
Sourcefn owning_windows(self, size: usize) -> Windows<Self, T> ⓘ
fn owning_windows(self, size: usize) -> Windows<Self, T> ⓘ
Returns an iterator of owned windows of length size.
The windows are contiguous and overlap. If the slice is shorter than size,
the iterator returns no values.