Trait par_stream::SliceExt [−][src]
pub trait SliceExt<T> {
fn concurrent_chunks(self, chunk_size: usize) -> ConcurrentChunks<Self, T>ⓘNotable traits for ConcurrentChunks<S, T>impl<S, T> Iterator for ConcurrentChunks<S, T> where
S: 'static + AsMut<[T]> + Send,
T: 'static + Send, type Item = Chunk<S, T>;
where
Self: 'static + AsMut<[T]> + Sized + Send,
T: 'static + Send,
{ ... }
fn concurrent_chunks_by_division(
self,
num_chunks: impl Into<Option<usize>>
) -> ConcurrentChunks<Self, T>ⓘNotable traits for ConcurrentChunks<S, T>impl<S, T> Iterator for ConcurrentChunks<S, T> where
S: 'static + AsMut<[T]> + Send,
T: 'static + Send, type Item = Chunk<S, T>;
where
Self: 'static + AsMut<[T]> + Sized + Send,
T: 'static + Send,
{ ... }
fn concurrent_iter(self: Arc<Self>) -> ConcurrentIter<Self, T>ⓘNotable traits for ConcurrentIter<S, T>impl<S, T> Iterator for ConcurrentIter<S, T> type Item = ArcRef<S, T>;
where
Self: 'static + AsRef<[T]> + Sized + Send,
{ ... }
}
Expand description
The trait provides extensions for concurrent processing on slice-like types.
Provided methods
fn concurrent_chunks(self, chunk_size: usize) -> ConcurrentChunks<Self, T>ⓘNotable traits for ConcurrentChunks<S, T>impl<S, T> Iterator for ConcurrentChunks<S, T> where
S: 'static + AsMut<[T]> + Send,
T: 'static + Send, type Item = Chunk<S, T>;
where
Self: 'static + AsMut<[T]> + Sized + Send,
T: 'static + Send,
fn concurrent_chunks(self, chunk_size: usize) -> ConcurrentChunks<Self, T>ⓘNotable traits for ConcurrentChunks<S, T>impl<S, T> Iterator for ConcurrentChunks<S, T> where
S: 'static + AsMut<[T]> + Send,
T: 'static + Send, type Item = Chunk<S, T>;
where
Self: 'static + AsMut<[T]> + Sized + Send,
T: 'static + Send,
impl<S, T> Iterator for ConcurrentChunks<S, T> where
S: 'static + AsMut<[T]> + Send,
T: 'static + Send, type Item = Chunk<S, T>;
Returns an iterator of 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.
fn concurrent_chunks_by_division(
self,
num_chunks: impl Into<Option<usize>>
) -> ConcurrentChunks<Self, T>ⓘNotable traits for ConcurrentChunks<S, T>impl<S, T> Iterator for ConcurrentChunks<S, T> where
S: 'static + AsMut<[T]> + Send,
T: 'static + Send, type Item = Chunk<S, T>;
where
Self: 'static + AsMut<[T]> + Sized + Send,
T: 'static + Send,
fn concurrent_chunks_by_division(
self,
num_chunks: impl Into<Option<usize>>
) -> ConcurrentChunks<Self, T>ⓘNotable traits for ConcurrentChunks<S, T>impl<S, T> Iterator for ConcurrentChunks<S, T> where
S: 'static + AsMut<[T]> + Send,
T: 'static + Send, type Item = Chunk<S, T>;
where
Self: 'static + AsMut<[T]> + Sized + Send,
T: 'static + Send,
impl<S, T> Iterator for ConcurrentChunks<S, T> where
S: 'static + AsMut<[T]> + Send,
T: 'static + Send, type Item = Chunk<S, T>;
Returns an iterator of exactly num_chunks
fixed-sized chunks of the slice.
The chunk size is determined by num_chunks
. The last chunk maybe shorter if
there aren’t enough elements. If num_chunks
is None
, it defaults to
the number of system processors.
The method is a proxy of concurrent_chunks
.
Panics
The method panics if num_chunks
is zero and slice length is not zero.
fn concurrent_iter(self: Arc<Self>) -> ConcurrentIter<Self, T>ⓘNotable traits for ConcurrentIter<S, T>impl<S, T> Iterator for ConcurrentIter<S, T> type Item = ArcRef<S, T>;
where
Self: 'static + AsRef<[T]> + Sized + Send,
impl<S, T> Iterator for ConcurrentIter<S, T> type Item = ArcRef<S, T>;