block_on

Function block_on 

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

Runs the given future to completion on the current thread. This function will block the current thread until the future is resolved. The way it works is by “spin-looping” over the poll method until it is ready.

It will not do any scheduling, nor will it launch any threads.

§Examples

use worst_executor::block_on;
block_on(async {
    println!("Hello, world!");
})