[][src]Function smol::block_on

pub fn block_on<T>(future: impl Future<Output = T>) -> T

Starts a thread-local executor and then runs the future.

Examples

use smol::Task;

smol::block_on(async {
    let task = Task::local(async {
        println!("Hello world");
    });
    task.await;
})