RayonPoolSpawner

Trait RayonPoolSpawner 

Source
pub trait RayonPoolSpawner: Spawner + Metrics {
    // Required method
    fn create_pool(
        &self,
        concurrency: NonZeroUsize,
    ) -> Result<ThreadPool, ThreadPoolBuildError>;

    // Provided method
    fn create_strategy(
        &self,
        concurrency: NonZeroUsize,
    ) -> Result<Rayon, ThreadPoolBuildError> { ... }
}
Expand description

Trait for creating rayon-compatible thread pools with each worker thread placed on dedicated threads via Spawner.

Required Methods§

Source

fn create_pool( &self, concurrency: NonZeroUsize, ) -> Result<ThreadPool, ThreadPoolBuildError>

Creates a clone-able rayon-compatible thread pool with Spawner::spawn.

§Arguments
  • concurrency: The number of tasks to execute concurrently in the pool.
§Returns

A Result containing the configured rayon::ThreadPool or a rayon::ThreadPoolBuildError if the pool cannot be built.

Provided Methods§

Source

fn create_strategy( &self, concurrency: NonZeroUsize, ) -> Result<Rayon, ThreadPoolBuildError>

Creates a clone-able Rayon strategy for use with commonware_parallel.

§Arguments
  • concurrency: The number of tasks to execute concurrently in the pool.
§Returns

A Result containing the configured Rayon strategy or a rayon::ThreadPoolBuildError if the pool cannot be built.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl RayonPoolSpawner for commonware_runtime::deterministic::Context

Source§

impl RayonPoolSpawner for commonware_runtime::tokio::Context

Source§

impl<C> RayonPoolSpawner for Cell<C>