Function create_pool

Source
pub fn create_pool<S: Spawner + Metrics>(
    context: S,
    concurrency: usize,
) -> Result<ThreadPool, ThreadPoolBuildError>
Expand description

Creates a rayon-compatible thread pool with Spawner::spawn_blocking.

§Arguments

  • context: The runtime context implementing the Spawner trait.
  • 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.