join

Macro join 

Source
macro_rules! join {
    ($($fut:expr),+ $(,)?) => { ... };
}
Expand description

Poll multiple futures concurrently, returning a future that outputs an array of all results once all futures have completed.

§Minimal polling

This future will only poll each inner future when it is awoken, rather than polling all inner futures on each iteration.

§Caveat

The futures must all have the same output type, which must be Unpin.

§Examples

use local_runtime::join;

let a = async { 1 };
let b = async { 2 };
let c = async { 3 };
assert_eq!(join!(a, b, c).await, [1, 2, 3]);