Module threads

Source
Expand description

Concurrency/parallelism utilities

Structs§

FutRunner
A fut_runner for a single future type. Either produced from the builder as a standalone fut_runner with it’s own limits, or from the FutRunnerShared factory where it shares limits with other fut_runners produced by said factory.
FutRunnerBuilder
A builder to configure either a standalone of shared fut_runner.
FutRunnerShared
A fut_runner producing factory that can be cloned and shares it’s limits with all other fut_runners spawned from this factory or any of it’s clones.

Statics§

FUT_RUNNER_PRIORITY_DEFAULT
The default priority of shared runners. By default everything has the highest priority.

Functions§

hint_stream_cb
Rust can sometimes fail to type hint the stream_cb callback argument.
new_fut_runner
Create a new builder for a standalone or shared fut_runner.
run_cpu_intensiverayon
The following link explains the distinction between normal tokio, tokio::task::spawn_blocking, and rayon. For most cases you think to use tokio::task::spawn_blocking, but isn’t actual IO like file read/write that isn’t async, and actually CPU bound stuff, rayon should be used. It goes without saying, if you ever want to use anything from rayon like rayon::iter::ParallelIterator, it should be inside run_cpu_intensive https://ryhl.io/blog/async-what-is-blocking/#the-rayon-crate