[][src]Macro async_macros::join_stream

macro_rules! join_stream {
    ($stream1:ident, $stream2:ident, $($stream:ident),* $(,)?) => { ... };
}

Combines multiple streams into a single stream of all their outputs.

This macro is only usable inside of async functions, closures, and blocks.

Examples

use async_macros::join_stream as join;
use futures::stream::{self, StreamExt};
use futures::future::ready;

let a = stream::once(ready(1u8));
let b = stream::once(ready(2u8));
let c = stream::once(ready(3u8));

let mut s = join!(a, b, c);

assert_eq!(s.next().await, Some(1u8));
assert_eq!(s.next().await, Some(2u8));
assert_eq!(s.next().await, Some(3u8));
assert_eq!(s.next().await, None);