bevy_tasks

Function block_on

Source
pub fn block_on<T>(future: impl Future<Output = T>) -> T
Available on non-crate feature async-io only.
Expand description

Blocks the current thread on a future.

ยงExamples

use futures_lite::future;

let val = future::block_on(async {
    1 + 2
});

assert_eq!(val, 3);