Skip to main content

block_on

Function block_on 

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

Drive future to completion on the current thread, returning its output.

Creates a fresh single-threaded executor and runs the event loop until the future resolves. Suitable for the top-level entry point of an async program.

§Example

let result = moduvex_runtime::block_on(async { 42u32 });
assert_eq!(result, 42);