fn flatten(self) -> Flatten<Self>
    where
        Self::Item: Stream,
        Self: Sized,
    {
        assert_stream::<<Self::Item as Stream>::Item, _>(Flatten::new(self))
    }
/// Flattens a stream of streams into just one continuous stream.
///
/// # Examples
///
/// ```
/// # futures::executor::block_on(async {
/// use futures::channel::mpsc;
/// use futures::stream::StreamExt;
/// use std::thread;
///
/// let (tx1, rx1) = mpsc::unbounded();
/// let (tx2, rx2) = mpsc::unbounded();
/// let (tx3, rx3) = mpsc::unbounded();
///
/// thread::spawn(move || {
///     tx1.unbounded_send(1).unwrap();
///     tx1.unbounded_send(2).unwrap();
/// });
/// thread::spawn(move || {
///     tx2.unbounded_send(3).unwrap();
///     tx2.unbounded_send(4).unwrap();
/// });
/// thread::spawn(move || {
///     tx3.unbounded_send(rx1).unwrap();
///     tx3.unbounded_send(rx2).unwrap();
/// });
///
/// let output = rx3.flatten().collect::<Vec<i32>>().await;
/// assert_eq!(output, vec![1, 2, 3, 4]);
/// # });
/// ```
Flattens a stream of streams into just one continuous stream.
Flattens a stream of streams into just one continuous stream .
fn flatten(self) -> Flatten<Self>
    where
        Self::Item: Stream,
        Self: Sized,
    {
        assert_stream::<<Self::Item as Stream>::Item, _>(Flatten::new(self))
    }
fn flatten ( self ) -> Flatten < Self > where Self :: Item : Stream , Self : Sized , { assert_stream :: < < Self :: Item as Stream > :: Item , _ > ( Flatten :: new ( self ) ) }
Flattens a stream of streams into just one continuous stream.
Flattens a stream of streams into just one continuous stream .
self
self
examples
None
futures::executor::block_on(async {
use futures::channel::mpsc;
use futures::stream::StreamExt;
use std::thread.



:spawn(move || {
tx1.unbounded_send(1).unwrap();
tx1.unbounded_send(2).unwrap();
});
thread::spawn(move || {
tx2.unbounded_send(3).unwrap();
tx2.unbounded_send(4).unwrap();
});
thread::spawn(move || {
tx3.unbounded_send(rx1).unwrap();
tx3.unbounded_send(rx2).unwrap();
}).


use futures :: channel :: mpsc ; use futures :: stream :: StreamExt ; use std :: thread . : spawn ( move || { tx1 . unbounded_send ( 1 ) . unwrap () ; tx1 . unbounded_send ( 2 ) . unwrap () ; } ) ; thread :: spawn ( move || { tx2 . unbounded_send ( 3 ) . unwrap () ; tx2 . unbounded_send ( 4 ) . unwrap () ; } ) ; thread :: spawn ( move || { tx3 . unbounded_send ( rx1 ) . unwrap () ; tx3 . unbounded_send ( rx2 ) . unwrap () ; } ) .
});
None