Function embassy_futures::join::join5

source ·
pub fn join5<Fut1, Fut2, Fut3, Fut4, Fut5>(
    future1: Fut1,
    future2: Fut2,
    future3: Fut3,
    future4: Fut4,
    future5: Fut5
) -> Join5<Fut1, Fut2, Fut3, Fut4, Fut5> where
    Fut1: Future,
    Fut2: Future,
    Fut3: Future,
    Fut4: Future,
    Fut5: Future,
Expand description

合并五个future的结果,等待他们都完成

本函数将以await的方式等待所有future都完成,并返回一个新的future 返回的future会以所有future的结果所组成的元组的方式进行输出。

注意,该函数会消耗传递的future,并会返回一个对其进行了封装的版本。


Joins the result of five futures, waiting for them all to complete.

This function will return a new future which awaits all futures to complete. The returned future will finish with a tuple of all results.

Note that this function consumes the passed futures and returns a wrapped version of it.

Examples


let a = async { 1 };
let b = async { 2 };
let c = async { 3 };
let d = async { 4 };
let e = async { 5 };
let res = embassy_futures::join::join5(a, b, c, d, e).await;

assert_eq!(res, (1, 2, 3, 4, 5));