[][src]Macro bastion::run

macro_rules! run {
    ($action:expr) => { ... };
    ($($tokens:tt)*) => { ... };
}

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

Example

let future1 = async move {
    123
};

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

let future2 = async move {
    10 / 2
};

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