[][src]Macro blocking::block_on

macro_rules! block_on {
    ($($code:tt)*) => { ... };
}

Blocks the current thread on async code.

Note that block_on!(expr) is just syntax sugar for block_on(async move { expr }).

Examples

use blocking::block_on;

let val = block_on! {
    1 + 2
};

assert_eq!(val, 3);