[][src]Crate bichannel

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

Structs

Channel

One side of a bidirectional channel. This channel can send to and receive from its counterpart.

RecvError

An error returned from the recv function on a Receiver.

SendError

An error returned from the Sender::send or SyncSender::send function on channels.

Enums

TryRecvError

This enumeration is the list of the possible reasons that try_recv could not return data when called. This can occur with both a channel and a sync_channel.

TrySendError

This enumeration is the list of the possible error outcomes for the try_send method.

Functions

channel

Creates a bichannelrectional channel returning the left and right sides. Each side can send and receive from its counterpart