pub struct ExecutionPolicy { /* private fields */ }Expand description
Immutable worker-budget policy with one persistent bounded execution pool.
requested_threads = None selects the available logical CPU count. Fixed
budgets are capped to that count. Cloned execution contexts share the same
Rayon pool, so prepared phases and workflow operations do not rebuild or
nest worker pools.
Implementations§
Source§impl ExecutionPolicy
impl ExecutionPolicy
Sourcepub fn new(
requested_threads: Option<usize>,
minimum_parallel_tasks: usize,
) -> Result<Self, ExecutionPolicyError>
pub fn new( requested_threads: Option<usize>, minimum_parallel_tasks: usize, ) -> Result<Self, ExecutionPolicyError>
Construct and retain the bounded execution context for this policy.
§Errors
Returns ExecutionPolicyError for zero budgets/thresholds or when
Rayon cannot build the resolved worker pool.
Sourcepub fn bounded_default() -> Result<Self, ExecutionPolicyError>
pub fn bounded_default() -> Result<Self, ExecutionPolicyError>
Construct the bounded two-thread default policy.
§Errors
Returns ExecutionPolicyError when Rayon cannot build the pool.
Sourcepub const fn requested_threads(&self) -> Option<usize>
pub const fn requested_threads(&self) -> Option<usize>
Return the requested fixed worker count, or None for automatic mode.
Sourcepub const fn minimum_parallel_tasks(&self) -> usize
pub const fn minimum_parallel_tasks(&self) -> usize
Return the independent-task threshold for parallel scheduling.
Sourcepub const fn resolved_budget(&self) -> usize
pub const fn resolved_budget(&self) -> usize
Return the resolved logical-CPU budget retained by this policy.
Sourcepub fn worker_count(&self, task_count: usize) -> usize
pub fn worker_count(&self, task_count: usize) -> usize
Return the worker count for a known number of independent tasks.
Sourcepub const fn context(&self) -> &ExecutionContext
pub const fn context(&self) -> &ExecutionContext
Borrow the persistent bounded execution context.
Trait Implementations§
Source§impl Clone for ExecutionPolicy
impl Clone for ExecutionPolicy
Source§fn clone(&self) -> ExecutionPolicy
fn clone(&self) -> ExecutionPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExecutionPolicy
impl Debug for ExecutionPolicy
impl Eq for ExecutionPolicy
Auto Trait Implementations§
impl !RefUnwindSafe for ExecutionPolicy
impl !UnwindSafe for ExecutionPolicy
impl Freeze for ExecutionPolicy
impl Send for ExecutionPolicy
impl Sync for ExecutionPolicy
impl Unpin for ExecutionPolicy
impl UnsafeUnpin for ExecutionPolicy
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
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> ⓘ
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> ⓘ
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