Skip to main content

block_on

Function block_on 

Source
pub fn block_on<F: Future>(future: F) -> F::Output
Expand description

Block on a future using an isolated Tokio runtime with one async worker.

The future is driven on the calling thread. Spawned async helpers use one additional worker, so they can progress while that thread blocks. Tokio may create further threads for spawn_blocking, filesystem or DNS operations. The worker count is explicit and independent of TOKIO_WORKER_THREADS.