Skip to main content

spawn

Function spawn 

pub fn spawn<F>(future: F) -> JoinHandle<<F as Future>::Output> 
where F: Future + Send + 'static, <F as Future>::Output: Send + 'static,
Available on crate feature dial9 only.
Expand description

Spawn a traced task on the current tokio runtime.

Like [tokio::spawn], but wraps the future with wake-event tracking when called from a thread owned by a dial9 runtime. On other threads, falls back to plain [tokio::spawn].

Equivalent to TelemetryHandle::current().spawn(future).

§Panics

Panics if called from outside a tokio runtime context (same as [tokio::spawn]).