channel_pipes

Crates.io Crates.io Crates.io
GitHub last commit Lines of code

Usage

If you use crossbeam-channel, add this to your Cargo.toml:

toml [dependencies] channel_pipes = { version = "0.2", features = ["crossbeam"] }

Examples

```rust use channelpipes::{operators::DistinctUntilChanged, CrossbeamSender, IntoPiped}; use crossbeamchannel::unbounded;

fn main() { let (s, r) = unbounded::().pipe().distinctuntilchanged();

let vec = vec![1, 2, 2, 3, 3, 3, 1];
for i in vec {
    s.send(i);
}

assert_eq!(Ok(1), r.try_recv());
assert_eq!(Ok(2), r.try_recv());
assert_eq!(Ok(3), r.try_recv());
assert_eq!(Ok(1), r.try_recv());
assert!(r.try_recv().is_err());

} ```