[][src]Macro pasts::join

macro_rules! join {
    ($($future:ident),* $(,)?) => { ... };
}

Poll multiple futures concurrently, and return a tuple of returned values from each future.

This macro is only usable inside async functions and blocks.

Futures that are ready first will be executed first. This makes join!(a, b) faster than the alternative (a.await, b.await).

#![forbid(unsafe_code)]

async fn one() -> char {
    'c'
}

async fn two() -> char {
    'a'
}

async fn example() {
    // Joined await on the two futures.
    let a = one();
    let b = two();
    let ret = pasts::join!(a, b);
    assert_eq!(ret, ('c', 'a'));
}

<pasts::ThreadInterrupt as pasts::Interrupt>::block_on(example());