Skip to main content

spawn_local

Function spawn_local 

Source
pub fn spawn_local<F>(future: F) -> JoinHandle<F::Output>
where F: Future + Send + 'static, F::Output: Send + 'static,
Expand description

Spawn this future on this local thread runtime.

You should generally replace your tokio::spawn with this. By using spawn_local instead of tokio::spawn, you give the load heuristic more information.

If your work truly does not have a thread affinity consideration, use spawn_balanced instead.