pub fn try_join_all<I>(iter: I) -> TryJoinAll<I::Item>
where
    I: IntoIterator,
    I::Item: TryFuture,
{
    let iter = iter.into_iter().map(TryFutureExt::into_future);

    #[cfg(futures_no_atomic_cas)]
    {
        let kind = TryJoinAllKind::Small {
            elems: iter.map(TryMaybeDone::Future).collect::<Box<[_]>>().into(),
        };

        assert_future::<Result<Vec<<I::Item as TryFuture>::Ok>, <I::Item as TryFuture>::Error>, _>(
            TryJoinAll { kind },
        )
    }

    #[cfg(not(futures_no_atomic_cas))]
    {
        let kind = match iter.size_hint().1 {
            Some(max) if max <= join_all::SMALL => TryJoinAllKind::Small {
                elems: iter.map(TryMaybeDone::Future).collect::<Box<[_]>>().into(),
            },
            _ => TryJoinAllKind::Big { fut: iter.collect::<FuturesOrdered<_>>().try_collect() },
        };

        assert_future::<Result<Vec<<I::Item as TryFuture>::Ok>, <I::Item as TryFuture>::Error>, _>(
            TryJoinAll { kind },
        )
    }
}
/// Creates a future which represents either a collection of the results of the
/// futures given or an error.
///
/// 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.
///
/// This function is only available when the `std` or `alloc` feature of this
/// library is activated, and it is activated by default.
///
/// # Examples
///
/// ```
/// # futures::executor::block_on(async {
/// use futures::future::{self, try_join_all};
///
/// let futures = vec![
///     future::ok::<u32, u32>(1),
///     future::ok::<u32, u32>(2),
///     future::ok::<u32, u32>(3),
/// ];
///
/// assert_eq!(try_join_all(futures).await, Ok(vec![1, 2, 3]));
///
/// let futures = vec![
///     future::ok::<u32, u32>(1),
///     future::err::<u32, u32>(2),
///     future::ok::<u32, u32>(3),
/// ];
///
/// assert_eq!(try_join_all(futures).await, Err(2));
/// # });
/// ```
Creates a future which represents either a collection of the results of the
futures given or an error.

The returned future will drive execution for all of its underlying futures,
collecting the results into a destination `Vec` 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.

This function is only available when the `std` or `alloc` feature of this
library is activated, and it is activated by default.
Creates a future which represents either a collection of the results of the futures given or an error . The returned future will drive execution for all of its underlying futures collecting the results into a destination ` Vec ` 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 . This function is only available when the ` std ` or ` alloc ` feature of this library is activated and it is activated by default .
pub fn try_join_all<I>(iter: I) -> TryJoinAll<I::Item>
where
    I: IntoIterator,
    I::Item: TryFuture,
{
    let iter = iter.into_iter().map(TryFutureExt::into_future);
    #[cfg(futures_no_atomic_cas)]
    {
        let kind = TryJoinAllKind::Small {
            elems: iter.map(TryMaybeDone::Future).collect::<Box<[_]>>().into(),
        };
        assert_future::<Result<Vec<<I::Item as TryFuture>::Ok>, <I::Item as TryFuture>::Error>, _>(
            TryJoinAll { kind },
        )
    }
    #[cfg(not(futures_no_atomic_cas))]
    {
        let kind = match iter.size_hint().1 {
            Some(max) if max <= join_all::SMALL => TryJoinAllKind::Small {
                elems: iter.map(TryMaybeDone::Future).collect::<Box<[_]>>().into(),
            },
            _ => TryJoinAllKind::Big { fut: iter.collect::<FuturesOrdered<_>>().try_collect() },
        };
        assert_future::<Result<Vec<<I::Item as TryFuture>::Ok>, <I::Item as TryFuture>::Error>, _>(
            TryJoinAll { kind },
        )
    }
}
pub fn try_join_all < I > ( iter : I ) -> TryJoinAll < I :: Item > where I : IntoIterator , I :: Item : TryFuture , { let iter = iter . into_iter ( ) . map ( TryFutureExt :: into_future ) ; # [ cfg ( futures_no_atomic_cas ) ] { let kind = TryJoinAllKind :: Small { elems : iter . map ( TryMaybeDone :: Future ) . collect :: < Box < [ _ ] > > ( ) . into ( ) , } ; assert_future :: < Result < Vec < < I :: Item as TryFuture > :: Ok > , < I :: Item as TryFuture > :: Error > , _ > ( TryJoinAll { kind } , ) } # [ cfg ( not ( futures_no_atomic_cas ) ) ] { let kind = match iter . size_hint ( ) . 1 { Some ( max ) if max <= join_all :: SMALL => TryJoinAllKind :: Small { elems : iter . map ( TryMaybeDone :: Future ) . collect :: < Box < [ _ ] > > ( ) . into ( ) , } , _ => TryJoinAllKind :: Big { fut : iter . collect :: < FuturesOrdered < _ > > ( ) . try_collect ( ) } , } ; assert_future :: < Result < Vec < < I :: Item as TryFuture > :: Ok > , < I :: Item as TryFuture > :: Error > , _ > ( TryJoinAll { kind } , ) } }
Creates a future which represents either a collection of the results of the
futures given or an error.
Creates a future which represents either a collection of the results of the futures given or an error .
iter
I
iter
I
examples
None
futures::executor::block_on(async {
use futures::future::{self, try_join_all}.







assert_eq!(try_join_all(futures).await, Err(2)).
use futures :: future :: { self try_join_all } . assert_eq! ( try_join_all ( futures ) . await Err ( 2 )) .
});
None