Function try_join
fn try_join<Fut1, Fut2>(future1: Fut1, future2: Fut2) -> TryJoin<Fut1, Fut2>
where
Fut1: TryFuture,
Fut2: TryFuture<Error = <Fut1 as >::Error>
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:
# block_on;
If one of the futures resolves to an error, try_join will return
that error:
# block_on;