[][src]Function futures::future::join_all

pub fn join_all<I>(i: I) -> JoinAll<<I as IntoIterator>::Item> where
    I: IntoIterator,
    <I as IntoIterator>::Item: Future

Creates a future which represents a collection of the outputs of the futures given.

The returned future will drive execution for all of its underlying futures, collecting the results into a destination Vec<T> in the same order as they were provided.

Examples

use futures_util::future::{FutureExt, join_all, ready};

let f = join_all(vec![
    ready::<u32>(1),
    ready::<u32>(2),
    ready::<u32>(3),
]);
let f = f.map(|x| {
    assert_eq!(x, [1, 2, 3]);
});