let result = executor::block_on({
let one = async { do_something_useful_one() };
let two = async { do_something_useful_two() };
one.await + two.await
});
See examples in:- What is the purpose of async/await in Rust? — https://stackoverflow.com/a/52835926/155423
And why this might be a bad idea in:
- What is the best approach to encapsulate blocking I/O in future-rs? — https://stackoverflow.com/q/41932137/155423