Function select_all

Source
pub async fn select_all<T>(
    futures: impl IntoIterator<Item = impl Future<Output = T>>,
) -> T
Expand description

Awaits a collection of futures concurrently and returns the output of the first future that completes.

Collects the input futures into a vector, then, if the collection is empty, it stalls by awaiting a pending future; otherwise, it races all the futures and returns the output from the one that finishes first.