Expand description
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);
Re-exports§
pub use rayon;
Structs§
- Async handle for a blocking task running in a Rayon thread pool.
Traits§
- Extension trait that integrates Rayon’s
ThreadPool
with Tokio.
Functions§
- Asynchronous wrapper around Rayon’s
spawn
. - Asynchronous wrapper around Rayon’s
spawn_fifo
.