Function smol::future::zip

source · []
pub fn zip<F1, F2>(future1: F1, future2: F2) -> Zip<F1, F2>Notable traits for Zip<F1, F2>impl<F1, F2> Future for Zip<F1, F2> where
    F1: Future,
    F2: Future
type Output = (<F1 as Future>::Output, <F2 as Future>::Output);
where
    F1: Future,
    F2: Future
Expand description

Joins two futures, waiting for both to complete.

Examples

use futures_lite::future;

let a = async { 1 };
let b = async { 2 };

assert_eq!(future::zip(a, b).await, (1, 2));