pub fn try_join<Fut1, Fut2>(future1: Fut1, future2: Fut2) -> TryJoin<Fut1, Fut2>
where
    Fut1: TryFuture,
    Fut2: TryFuture<Error = Fut1::Error>,
{
    assert_future::<Result<(Fut1::Ok, Fut2::Ok), Fut1::Error>, _>(TryJoin::new(future1, future2))
}
Joins the result of two futures, waiting for them both to complete or
for one to produce an error.

This function will return a new future which awaits both futures to
complete. If successful, the returned future will finish with a tuple of
both results. If unsuccessful, it will complete with the first error
encountered.

Note that this function consumes the passed futures and returns a
wrapped version of it.

# Examples

When used on multiple futures that return [`Ok`], `try_join` will return
[`Ok`] of a tuple of the values:

```
# futures::executor::block_on(async {
use futures::future;

let a = future::ready(Ok::<i32, i32>(1));
let b = future::ready(Ok::<i32, i32>(2));
let pair = future::try_join(a, b);

assert_eq!(pair.await, Ok((1, 2)));
# });
```

If one of the futures resolves to an error, `try_join` will return
that error:

```
# futures::executor::block_on(async {
use futures::future;

let a = future::ready(Ok::<i32, i32>(1));
let b = future::ready(Err::<i32, i32>(2));
let pair = future::try_join(a, b);

assert_eq!(pair.await, Err(2));
# });
```
futures-util/src/future/try_join.rs