#channel #message #bidirectional #send #crossbeam-channel #thread #move

doublecross

Bi-directional channels for rust based on crossbeam-channel

3 unstable releases

Uses old Rust 2015

0.2.1 Sep 21, 2018
0.2.0 Sep 21, 2018
0.1.0 Sep 21, 2018

#39 in #bidirectional

MPL-2.0 license

9KB
92 lines

doublecross

Build Status License Cargo Documentation

Bi-directional channels for communicating between threads based on crossbeam-channel.

example

let (left, right) = unbounded::<bool, i32>();
thread::spawn(move || {
    loop {
        let val = right.recv().unwrap();
        right.send(val % 2 == 0);
    }
});

for i in 0..10 {
    left.send(i);
    if left.recv().unwrap() {
        println!("{} is even", i);
    }
}

usage

[dependencies]
doublecross = "0.2"

license

Licensed under the terms of of the MPL-2.0.

Dependencies

~2MB
~30K SLoC