Skip to content

tvrg/stream-kmerge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stream KMerge

K-way merge for rust streams.

build_status crates.io

How to use with Cargo:

[dependencies]
stream-kmerge = "0.1"

How to use in your crate:

use stream_kmerge::kmerge_by;

Example

use futures::{stream, StreamExt};
use stream_kmerge::kmerge_by;

#[tokio::main(flavor = "current_thread")]
async fn main() {
    let streams = vec![stream::iter(vec![1, 3, 5]), stream::iter(vec![2, 3, 4])];

    assert_eq!(
        kmerge_by(streams, |x: &usize, y: &usize| y.cmp(&x)).collect::<Vec<usize>>().await,
        vec![1, 2, 3, 3, 4, 5],
    );
}

License

Dual-licensed to be compatible with the Rust project.

Licensed under the Apache License, Version 2.0 https://www.apache.org/licenses/LICENSE-2.0 or the MIT license https://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.

Portions of the project have been copied from https://github.com/rust-itertools/itertools which is copyrighted under the Apache License, Version 2.0 https://www.apache.org/licenses/LICENSE-2.0 or the MIT license https://opensource.org/licenses/MIT, at your option. See https://github.com/rust-itertools/itertools/blob/6c4fc2f8e745fe4780578dfa4feb44ccccffb521/src/kmerge_impl.rs for the original code.

About

K-way merge for rust streams

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages