pub fn spawn<T>(
key: impl Key,
root_span: impl Into<Span>,
future: T,
) -> JoinHandle<T::Output>
Expand description
Spawns a new asynchronous task instrumented with the given root Span
, returning a
JoinHandle
for it.
The spawned task will be registered in the current Registry
returned by
Registry::try_current
with the given Key
, if it exists. Otherwise, this is equivalent to
tokio::spawn
.