join_all!() { /* proc-macro */ }Expand description
Joins multiple futures into an array, waiting for all to complete.
The join_all! macro is like join! but returns an array instead of a
tuple. It uses the same concurrent polling expansion, so all branches are
driven together within the enclosing task while preserving input order in
the returned array.
§Syntax
ⓘ
join_all!(future1, future2, ...)§Returns
An array of all the futures’ results in the order they were specified. Since all results must be the same type, this enables easier iteration.
§Example
ⓘ
let results: [i32; 3] = join_all!(
fetch_value(1).await,
fetch_value(2).await,
fetch_value(3).await
);
for result in results {
println!("{}", result);
}