pub struct ParallelExecutor { /* private fields */ }Expand description
Branch-level parallel executor.
Holds the configured worker count and a “shutdown” flag. Each call
to Self::execute_branches runs the supplied workers in parallel
(when enabled and above the branching threshold) and collects
their results in input order.
Implementations§
Source§impl ParallelExecutor
impl ParallelExecutor
Sourcepub fn new(max_workers: usize) -> Self
pub fn new(max_workers: usize) -> Self
Build an executor with at most max_workers concurrent
branches. 0 disables parallel dispatch (every branch runs
sequentially).
Sourcepub fn shutdown(&self)
pub fn shutdown(&self)
Mark the executor as shut down. Subsequent
Self::execute_branches calls fall back to sequential
execution.
Sourcepub fn execute_branches<R, F>(&self, workers: &[F]) -> Vec<R>
pub fn execute_branches<R, F>(&self, workers: &[F]) -> Vec<R>
Run each worker and collect results in the same order. Uses
rayon’s work-stealing pool when Self::enabled is true and
the branch count is at least MIN_PARALLEL_BRANCHES;
otherwise falls back to sequential execution.
Trait Implementations§
Source§impl Clone for ParallelExecutor
impl Clone for ParallelExecutor
Source§fn clone(&self) -> ParallelExecutor
fn clone(&self) -> ParallelExecutor
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 moreSource§impl Debug for ParallelExecutor
impl Debug for ParallelExecutor
Auto Trait Implementations§
impl Freeze for ParallelExecutor
impl RefUnwindSafe for ParallelExecutor
impl Send for ParallelExecutor
impl Sync for ParallelExecutor
impl Unpin for ParallelExecutor
impl UnsafeUnpin for ParallelExecutor
impl UnwindSafe for ParallelExecutor
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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