3 releases

0.1.2 Mar 1, 2022
0.1.1 Feb 28, 2022
0.1.0 Feb 24, 2022

#602 in Asynchronous

Download history 3277/week @ 2023-11-27 1780/week @ 2023-12-04 1179/week @ 2023-12-11 991/week @ 2023-12-18 236/week @ 2023-12-25 1395/week @ 2024-01-01 1587/week @ 2024-01-08 1072/week @ 2024-01-15 1668/week @ 2024-01-22 1733/week @ 2024-01-29 1854/week @ 2024-02-05 1449/week @ 2024-02-12 1075/week @ 2024-02-19 1419/week @ 2024-02-26 1699/week @ 2024-03-04 474/week @ 2024-03-11

4,693 downloads per month
Used in geyser-grpc-connector

MIT/Apache

25KB
478 lines

merge-streams

Merge multiple streams into one.

Based on Yoshua Wuyts's futures-concurrency crate and the corresponding Futures Concurrency III post. Since the futures-concurrency crate now supports stable Rust too, there is no reason to this crate instead anymore.

Example

Merge multiple streams to handle values as soon as they're ready, without ever dropping a single value:

use merge_streams::MergeStreams;
use futures_lite::future::block_on;
use futures_lite::{stream, StreamExt};
fn main() {
    block_on(async {
        let a = stream::once(1);
        let b = stream::once(2);
        let c = stream::once(3);
        let mut s = (a, b, c).merge();
        let mut counter = 0;
        s.for_each(|n| counter += n).await;
        assert_eq!(counter, 6);
    })
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~0.4–0.9MB
~19K SLoC