Function std::future::join

Overview
async fn join(value: any) -> any

Waits for a collection of futures to complete and joins their result.

Examples

use std::future;

let a = async { 1 };
let b = async { 2 };
let (a, b) = future::join((a, b)).await;
assert_eq!(1, a);
assert_eq!(2, b);

Using a vector:

use std::future;

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

Joining an empty collection:

use std::future;

let () = future::join(()).await;
let [] = future::join([]).await;