Function async_global_executor::block_on

source ·
pub fn block_on<F: Future<Output = T>, T>(future: F) -> T
Expand description

Runs the global and the local executor on the current thread

Note: this calls async_io::block_on underneath.

§Examples

let task = async_global_executor::spawn(async {
    1 + 2
});
async_global_executor::block_on(async {
    assert_eq!(task.await, 3);
});