futures-stream-select-all-send

Crates.iofutures-stream-select-all-send
lib.rsfutures-stream-select-all-send
version0.1.2
sourcesrc
created_at2018-07-04 18:22:42.085881
updated_at2018-07-04 18:22:42.085881
descriptionA futures library adapter for merging the output of several streams
homepagehttps://github.com/vpzomtrrfrt/futures-stream-select-all-send
repositoryhttps://github.com/vpzomtrrfrt/futures-stream-select-all-send
max_upload_size
id72888
size5,962
(vpzomtrrfrt)

documentation

README

futures-stream-select-all

A futures library adapter for merging the output of several streams.

It implements a binary-tree structure to efficiently perform select for any amount of undelying streams.

Usage

First, add this to your Cargo.toml:

[dependencies]
futures-stream-select-all = "0.1"

Next, add this to your crate:

extern crate futures-stream-select-all;

use futures_stream_select_all::select_all;

Example

    use futures::{stream, Stream, Future};
    use futures_stream_select_all::select_all;

    let stream_a = stream::iter(vec![Ok(0), Ok(1)]);
    let stream_b = stream::iter(vec![Ok(2), Ok(3), Ok(4)]);
    let stream_c = stream::iter(vec![Ok(5)]);

    let mut values = select_all::<_, _, ()>(vec![stream_a, stream_b, stream_c])
        .collect()
        .wait()
        .unwrap();
    values.sort();
    assert_eq!(values, vec![0, 1, 2, 3, 4, 5]);

License

futures-stream-select-all is primarily distributed under the terms of the MIT license.

See LICENSE-MIT for details.

Commit count: 4

cargo fmt