[−][src]Function futures_lite::future::try_join
pub fn try_join<T1, T2, E, Fut1, Fut2>(
future1: Fut1,
future2: Fut2
) -> TryJoin<Fut1, Fut2>ⓘ where
Fut1: Future<Output = Result<T1, E>>,
Fut2: Future<Output = Result<T2, E>>,
Joins two fallible futures, waiting for both to complete or one of them to error.
Examples
use futures_lite::*; let a = async { Ok::<i32, i32>(1) }; let b = async { Err::<i32, i32>(2) }; assert_eq!(future::try_join(a, b).await, Err(2));