Crate tokio_rayon[][src]

Tokio’s spawn_blocking and block_in_place run blocking code on a potentially large number of Tokio-controlled threads. This is suitable for blocking I/O, but CPU-heavy operations are often better served by a fixed-size thread pool. The Rayon crate provides exactly this, so… Why not combine them? :)

let nft = tokio_rayon::spawn(|| {
  do_some_crypto_stuff()
}).await;

assert_eq!(nft, ExpensiveNft);

Structs

AsyncRayonHandle

Async handle for a blocking task running in a Rayon thread pool.

Traits

AsyncThreadPool

Extension trait that integrates Rayon’s ThreadPool with Tokio.

Functions

spawn

Asynchronous wrapper around Rayon’s spawn.

spawn_fifo

Asynchronous wrapper around Rayon’s spawn_fifo.