pub struct ExecutionContext { /* private fields */ }Expand description
Reusable, operation-owned worker pool with deterministic ordered mapping.
The context never installs or mutates Rayon’s global pool. A one-thread context executes closures directly, which also prevents nested pools when Python already schedules independent native batches.
Implementations§
Source§impl ExecutionContext
impl ExecutionContext
Sourcepub fn new(threads: usize) -> Result<Self, ThreadPoolBuildError>
pub fn new(threads: usize) -> Result<Self, ThreadPoolBuildError>
Construct a context with an exact positive worker budget.
§Errors
Returns ThreadPoolBuildError when Rayon cannot build the bounded
worker pool.
Sourcepub fn map_ordered<R, F>(
&self,
item_count: usize,
minimum_parallel_items: usize,
operation: F,
) -> Vec<R>
pub fn map_ordered<R, F>( &self, item_count: usize, minimum_parallel_items: usize, operation: F, ) -> Vec<R>
Map independent indices while collecting results in increasing order.
Work below minimum_parallel_items remains serial. Indexed Rayon
collection preserves the input order independently of completion order.
Trait Implementations§
Source§impl Clone for ExecutionContext
impl Clone for ExecutionContext
Source§fn clone(&self) -> ExecutionContext
fn clone(&self) -> ExecutionContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ExecutionContext
impl !UnwindSafe for ExecutionContext
impl Freeze for ExecutionContext
impl Send for ExecutionContext
impl Sync for ExecutionContext
impl Unpin for ExecutionContext
impl UnsafeUnpin for ExecutionContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more