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

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

Creates a future which represents a collection of the results 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. If any future returns an error then all other futures will be canceled and an error will be returned immediately. If all futures complete successfully, however, then the returned future will succeed with a `Vec` of all the successful results.

# Examples

    use futures::future::*;

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

    let f = join_all(vec![
        Box::new(ok::<u32, u32>(1)),
        Box::new(err::<u32, u32>(2)),
        Box::new(ok::<u32, u32>(3)),
    ]);
    let f = f.then(|x| {
        assert_eq!(x, Err(2));
        x
    });

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)