Skip to main content

Strategizer

Trait Strategizer 

Source
pub trait Strategizer: Spawner {
    // Required method
    fn strategy(&self, parallelism: NonZeroUsize) -> Rayon;
}
Expand description

Interface that runtimes implement to provide parallel execution strategies.

Required Methods§

Source

fn strategy(&self, parallelism: NonZeroUsize) -> Rayon

Returns a new Rayon strategy with the requested parallelism.

§Arguments
  • parallelism: The number of tasks to execute concurrently in the pool.
§Panics

Panics if the runtime cannot initialize the strategy’s backing Rayon thread pool.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Strategizer for commonware_runtime::deterministic::Context

Spawning threads would be nondeterministic, so the pool has no background workers. The executor thread registers itself as its sole member and all work executes inline.

Rayon’s current-thread registration is permanent and per-OS-thread, so only one pool can ever execute work on the executor thread. Every request (including from a later runner on the same thread) returns a strategy on that single-threaded pool with its planning parallelism set independently. This controls adaptive decisions and manual partitioning hints while Rayon executes on the sole registered thread. The returned strategy is therefore tied to the executor thread.

Source§

impl Strategizer for commonware_runtime::tokio::Context

Available on neither commonware_stability_DELTA nor commonware_stability_EPSILON nor commonware_stability_GAMMA nor commonware_stability_RESERVED.