fn try_collect<C: Default + Extend<Self::Ok>>(self) -> TryCollect<Self, C>
    where
        Self: Sized,
    {
        assert_future::<Result<C, Self::Error>, _>(TryCollect::new(self))
    }
/// Attempt to transform a stream into a collection,
/// returning a future representing the result of that computation.
///
/// This combinator will collect all successful results of this stream and
/// collect them into the specified collection type. If an error happens then all
/// collected elements will be dropped and the error will be returned.
///
/// The returned future will be resolved when the stream terminates.
///
/// # Examples
///
/// ```
/// # futures::executor::block_on(async {
/// use futures::channel::mpsc;
/// use futures::stream::TryStreamExt;
/// use std::thread;
///
/// let (tx, rx) = mpsc::unbounded();
///
/// thread::spawn(move || {
///     for i in 1..=5 {
///         tx.unbounded_send(Ok(i)).unwrap();
///     }
///     tx.unbounded_send(Err(6)).unwrap();
/// });
///
/// let output: Result<Vec<i32>, i32> = rx.try_collect().await;
/// assert_eq!(output, Err(6));
/// # })
/// ```
Attempt to transform a stream into a collection,
returning a future representing the result of that computation.

This combinator will collect all successful results of this stream and
collect them into the specified collection type. If an error happens then all
collected elements will be dropped and the error will be returned.

The returned future will be resolved when the stream terminates.
Attempt to transform a stream into a collection returning a future representing the result of that computation . This combinator will collect all successful results of this stream and collect them into the specified collection type . If an error happens then all collected elements will be dropped and the error will be returned . The returned future will be resolved when the stream terminates .
fn try_collect<C: Default + Extend<Self::Ok>>(self) -> TryCollect<Self, C>
    where
        Self: Sized,
    {
        assert_future::<Result<C, Self::Error>, _>(TryCollect::new(self))
    }
fn try_collect < C : Default + Extend < Self :: Ok > > ( self ) -> TryCollect < Self , C > where Self : Sized , { assert_future :: < Result < C , Self :: Error > , _ > ( TryCollect :: new ( self ) ) }
Attempt to transform a stream into a collection,
returning a future representing the result of that computation.
Attempt to transform a stream into a collection returning a future representing the result of that computation .
self
self
examples
None
futures::executor::block_on(async {
use futures::channel::mpsc;
use futures::stream::TryStreamExt;
use std::thread.

let (tx, rx) = mpsc::unbounded().



let output: Result, i32> = rx.try_collect().await;
assert_eq!(output, Err(6)).
use futures :: channel :: mpsc ; use futures :: stream :: TryStreamExt ; use std :: thread . let ( tx rx ) = mpsc :: unbounded () . let output : Result i32 > = rx . try_collect () . await ; assert_eq! ( output Err ( 6 )) .
})
None