Expand description
Parallel processing abstractions for OxiRS
This module provides unified parallel processing operations across the OxiRS ecosystem. All parallel operations must go through this module - direct Rayon usage in other modules is forbidden.
Structs§
- Thread
Pool - Represents a user-created thread pool.
- Thread
Pool Builder - Used to create a new
ThreadPool
or to configure the global rayon thread pool.
Traits§
- From
Parallel Iterator FromParallelIterator
implements the creation of a collection from aParallelIterator
. By implementingFromParallelIterator
for a given type, you define how it will be created from an iterator.- Indexed
Parallel Iterator - An iterator that supports “random access” to its data, meaning that you can split it at arbitrary indices and draw data from those points.
- Into
Parallel Iterator IntoParallelIterator
implements the conversion to aParallelIterator
.- Into
Parallel RefIterator IntoParallelRefIterator
implements the conversion to aParallelIterator
, providing shared references to the data.- Into
Parallel RefMut Iterator IntoParallelRefMutIterator
implements the conversion to aParallelIterator
, providing mutable references to the data.- Parallel
Bridge - Conversion trait to convert an
Iterator
to aParallelIterator
. - Parallel
Drain Full ParallelDrainFull
creates a parallel iterator that moves all items from a collection while retaining the original capacity.- Parallel
Drain Range ParallelDrainRange
creates a parallel iterator that moves a range of items from a collection while retaining the original capacity.- Parallel
Extend ParallelExtend
extends an existing collection with items from aParallelIterator
.- Parallel
Iterator - Parallel version of the standard iterator trait.
- Parallel
Slice - Parallel extensions for slices.
- Parallel
Slice Mut - Parallel extensions for mutable slices.
- Parallel
String - Parallel extensions for strings.
Functions§
- current_
num_ threads - Returns the number of threads in the current registry. If this code is executing within a Rayon thread pool, then this will be the number of threads for the thread pool of the current thread. Otherwise, it will be the number of threads for the global thread pool.
- is_
parallel_ enabled - Check if parallel processing is enabled
- join
- Takes two closures and potentially runs them in parallel. It returns a pair of the results from those closures.
- map
- Map a function over a slice in parallel
- num_
threads - Get the number of threads available for parallel operations
- par_
chunks - Process a slice in parallel chunks
- par_
join - Execute two closures potentially in parallel
- parallel_
map - Map a function over a slice in parallel (alias for map)
- scope
- Creates a “fork-join” scope
s
and invokes the closure with a reference tos
. This closure can then spawn asynchronous tasks intos
. Those tasks may run asynchronously with respect to the closure; they may themselves spawn additional tasks intos
. When the closure returns, it will block until all tasks that have been spawned intos
complete. - spawn
- Puts the task into the Rayon thread pool’s job queue in the “static”
or “global” scope. Just like a standard thread, this task is not
tied to the current stack frame, and hence it cannot hold any
references other than those with
'static
lifetime. If you want to spawn a task that references stack data, use thescope()
function to create a scope.