#channel #bidirectional #zero #mpsc #send-receive #side #counterpart

bichannel

Zero dependency std::mpsc based bidirectional channel

4 releases

0.0.4 Nov 9, 2020
0.0.3 Nov 9, 2020
0.0.2 Nov 9, 2020
0.0.1 Nov 9, 2020

#900 in Concurrency

Download history 45/week @ 2024-02-19 10/week @ 2024-02-26 10/week @ 2024-03-04 13/week @ 2024-03-11

78 downloads per month
Used in post_maker

MIT/Apache

11KB
77 lines

bichannel

A zero dependency std::sync::mpsc based bidirectional channel. Each side can send and receive with its counterpart

Getting Started

bichannel = "1"

Example Usage

let (left, right) = bichannel::channel();

// Send from the left to the right
left.send(1).unwrap();
assert_eq!(Ok(1), right.recv());

// Send from the right to the left
right.send(2).unwrap();
assert_eq!(Ok(2), left.recv());

License

TODO MIT/APACHE

Contributing

Bug reports, feature requests, and contributions are warmly welcomed.

NOTE: This README uses cargo-readme. To update the README, use cargo readme > README.md


lib.rs:

Zero dependency std::sync based bidirectional channels. Each side can send and receive with its counterpart.

Note, the default Channel inherits !Sync from std::sync::mpsc::Receiver. If you would prefer, a crossbeam implementation is available by enabling the crossbeam flag. In addition to its desirable performance characteristics, it also drops this !Sync constraint.

Getting Started

bichannel = "1"

Example Usage

let (left, right) = bichannel::channel();

// Send from the left to the right
left.send(1).unwrap();
assert_eq!(Ok(1), right.recv());

// Send from the right to the left
right.send(2).unwrap();
assert_eq!(Ok(2), left.recv());

License

TODO MIT/APACHE

Contributing

Bug reports, feature requests, and contributions are warmly welcomed.

NOTE: This README uses cargo-readme. To update the README, use cargo readme > README.md

Dependencies

~76KB