usesuper::assert_future; usecrate::future::{maybe_done, MaybeDone}; use core::fmt; use core::pin::Pin; use futures_core::future::{FusedFuture, Future}; use futures_core::task::{Context, Poll}; use pin_project_lite::pin_project;
generate! { /// Future for the [`join`](join()) function.
(Join, <Fut1, Fut2>),
/// Future for the [`join3`] function.
(Join3, <Fut1, Fut2, Fut3>),
/// Future for the [`join4`] function.
(Join4, <Fut1, Fut2, Fut3, Fut4>),
/// Future for the [`join5`] function.
(Join5, <Fut1, Fut2, Fut3, Fut4, Fut5>),
}
/// Joins the result of two futures, waiting for them both to complete. /// /// This function will return a new future which awaits both futures to /// complete. The returned future will finish with a tuple of both results. /// /// Note that this function consumes the passed futures and returns a /// wrapped version of it. /// /// # Examples /// /// ``` /// # futures::executor::block_on(async { /// use futures::future; /// /// let a = async { 1 }; /// let b = async { 2 }; /// let pair = future::join(a, b); /// /// assert_eq!(pair.await, (1, 2)); /// # }); /// ``` pubfn join<Fut1, Fut2>(future1: Fut1, future2: Fut2) -> Join<Fut1, Fut2> where
Fut1: Future,
Fut2: Future,
{ let f = Join::new(future1, future2);
assert_future::<(Fut1::Output, Fut2::Output), _>(f)
}
/// Same as [`join`](join()), but with more futures. /// /// # Examples /// /// ``` /// # futures::executor::block_on(async { /// use futures::future; /// /// let a = async { 1 }; /// let b = async { 2 }; /// let c = async { 3 }; /// let tuple = future::join3(a, b, c); /// /// assert_eq!(tuple.await, (1, 2, 3)); /// # }); /// ``` pubfn join3<Fut1, Fut2, Fut3>(
future1: Fut1,
future2: Fut2,
future3: Fut3,
) -> Join3<Fut1, Fut2, Fut3> where
Fut1: Future,
Fut2: Future,
Fut3: Future,
{ let f = Join3::new(future1, future2, future3);
assert_future::<(Fut1::Output, Fut2::Output, Fut3::Output), _>(f)
}
/// Same as [`join`](join()), but with more futures. /// /// # Examples /// /// ``` /// # futures::executor::block_on(async { /// use futures::future; /// /// let a = async { 1 }; /// let b = async { 2 }; /// let c = async { 3 }; /// let d = async { 4 }; /// let tuple = future::join4(a, b, c, d); /// /// assert_eq!(tuple.await, (1, 2, 3, 4)); /// # }); /// ``` pubfn join4<Fut1, Fut2, Fut3, Fut4>(
future1: Fut1,
future2: Fut2,
future3: Fut3,
future4: Fut4,
) -> Join4<Fut1, Fut2, Fut3, Fut4> where
Fut1: Future,
Fut2: Future,
Fut3: Future,
Fut4: Future,
{ let f = Join4::new(future1, future2, future3, future4);
assert_future::<(Fut1::Output, Fut2::Output, Fut3::Output, Fut4::Output), _>(f)
}
/// Same as [`join`](join()), but with more futures. /// /// # Examples /// /// ``` /// # futures::executor::block_on(async { /// use futures::future; /// /// let a = async { 1 }; /// let b = async { 2 }; /// let c = async { 3 }; /// let d = async { 4 }; /// let e = async { 5 }; /// let tuple = future::join5(a, b, c, d, e); /// /// assert_eq!(tuple.await, (1, 2, 3, 4, 5)); /// # }); /// ``` pubfn 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,
{ let f = Join5::new(future1, future2, future3, future4, future5);
assert_future::<(Fut1::Output, Fut2::Output, Fut3::Output, Fut4::Output, Fut5::Output), _>(f)
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.