Crate doublecross

Source
Expand description

Bi-directional channels built on crossbeam_channel

§Examples

// doublecross supports different types for each
// direction in the channel: the type arguments are
// the receive/send types for the left channel, and 
// the send/receive types for the right channel.
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);
    }
}

Structs§

BiChannel
Bi-directional communication build on, and usable with, crossbeam-channel channels.

Functions§

bounded
Creates a bi-directional channel of bounded capacity.
unbounded
Creates a bi-directional channel of unbounded capacity.