pub trait Executor: Send + Sync {
// Required method
fn execute<C, F>(
&self,
jobs: Vec<Job<C>>,
run: F,
cancel: &CancelToken,
) -> Vec<(Job<C>, Outcome<C>)>
where C: Send + 'static,
F: Fn(&Job<C>) -> Outcome<C> + Send + Sync;
}Expand description
Runs a batch of jobs, possibly in parallel.
The engine collects the ready nodes of a round into jobs, hands the batch
to an executor together with a pure run closure, and merges the results
back into the tree in job order — so runs are deterministic regardless of
the executor used.
§Contract
Implementations must return the executed jobs paired with their outcomes, in input order, and may stop early: the returned vector may be a prefix (possibly empty) of the input batch. The engine treats a short result as a cancellation and leaves the un-merged nodes untouched for a later run.
§Provided implementations
SerialExecutor— runs jobs one at a time (default, zero cost).- [
RayonExecutor] — runs jobs on a rayon thread pool (requires theparallelfeature).
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".