Module mz_ore::task

source ·
Available on crate feature async only.
Expand description

Tokio task utilities.

§Named task spawning

The spawn and spawn_blocking methods are wrappers around tokio::task::spawn and tokio::task::spawn_blocking that attach a name the spawned task.

If Clippy sent you here, replace:

tokio::task::spawn(my_future)
tokio::task::spawn_blocking(my_blocking_closure)

with:

mz_ore::task::spawn(|| format!("taskname:{}", info), my_future)
mz_ore::task::spawn_blocking(|| format!("name:{}", info), my_blocking_closure)

If you are using methods of the same names on a Runtime or Handle, import RuntimeExt and replace spawn with RuntimeExt::spawn_named and spawn_blocking with RuntimeExt::spawn_blocking_named, adding naming closures like above.

Structs§

Traits§

Functions§