Multi stream

Aggregate multiple streams of different types in a single stream with an item type that is a tuple of the incoming stream items.

Important

Example usage

[tokio::main]

async fn main() { let a = stream! { sleep(Duration::frommillis(random::().into())).await; yield 1; sleep(Duration::frommillis(random::().into())).await; yield 2; sleep(Duration::frommillis(random::().into())).await; yield 3; }; let b = stream! { sleep(Duration::frommillis(random::().into())).await; yield 4; sleep(Duration::frommillis(random::().into())).await; yield 5; sleep(Duration::frommillis(random::().into())).await; yield 6; };

multi_stream!(a, b)
    .for_each(|(a, b)| async move {
        //emitted when any of the streams has a new value
        dbg!((a, b));
    })
    .await;

} ```