Allow using collect to turn a vec of futures into a future of vec
Allow using collect to turn a vec of futures into a future of vec

In today's Rust, it is possible to go from `Vec<Option<T>>` to
`Option<Vec<T>>` and from `Vec<Result<T, E>>` to `Result<Vec<T>, E>`:

    let xs = vec![Some(1), Some(2), Some(3)];
    let xs: Option<Vec<_>> = xs.into_iter().collect();
    assert_eq!(xs, Some(vec![1, 2, 3]));

    let xs = vec![Ok(1), Ok(2), Err(92)];
    let xs: Result<Vec<_>, _> = xs.into_iter().collect();
    assert_eq!(xs, Err(92));

These are the instances of a general phenomenon, which allows to pull
the inner monad outside of the list; see [1] for theory behind this.

As futures are a monad, it makes sense to provide a similar api: a way
to go from `Vec<Future<T, E>>` to `Future<Vec<T>, E>` via `collect`.
However in Rust future is not a single type, but a trait, so we need to
implement `FromIterator` for some particular future, and it is `JoinAll`
in our case. Note that the user will have to provide `JoinAll` type
on call-site via ::<> or type ascription.

[1]: https://hackage.haskell.org/package/base-4.10.1.0/docs/Data-Traversable.html#v:sequenceA

alexcrichton/futures-rs