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§
- Abort
OnDrop Handle - Wraps a
JoinHandleto abort the underlying task when dropped. - Join
Handle - Wraps a tokio
JoinHandleand provides 4 exclusive (i.e. they takeselfownership) operations:
Traits§
- Join
Handle Ext - Extension methods for
JoinHandleandAbortOnDropHandle. - Join
SetExt - Extension methods for
tokio::task::JoinSet. - Runtime
Ext - Extension methods for
RuntimeandHandle.
Functions§
- spawn
- Spawns a new asynchronous task with a name.
- spawn_
blocking - Runs the provided closure with a name on a thread where blocking is acceptable.
- unpack_
join_ 🔒result