pub fn block_on<T>(future: impl Future<Output = T>) -> T
Expand description
Blocks the current thread on a future, processing I/O events when idle.
§Examples
use async_io::Timer;
use std::time::Duration;
async_io::block_on(async {
// This timer will likely be processed by the current
// thread rather than the fallback "async-io" thread.
Timer::after(Duration::from_millis(1)).await;
});