[][src]Function bastion::executor::run

pub fn run<F, T>(future: F) -> T where
    F: Future<Output = T>, 

Block the current thread until passed future is resolved with an output (including the panic).

Example

use bastion::executor::run;
let future1 = async move {
    123
};

run(async move {
    let result = future1.await;
    assert_eq!(result, 123);
});

let future2 = async move {
    10 / 2
};

let result = run(future2);
assert_eq!(result, 5);