idletea / doublecross

crossbeam-channel based bi-directional signalling

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

crossbeam-channel based bi-directional signalling

License:Mozilla Public License 2.0


Languages

Language:Rust 100.0%