Function flume::unbounded

source ·
pub fn unbounded<T>() -> (Sender<T>, Receiver<T>)
Expand description

Create a channel with no maximum capacity.

Create an unbounded channel with a Sender and Receiver connected to each end respectively. Values sent in one end of the channel will be received on the other end. The channel is thread-safe, and both Sender and Receiver may be sent to or shared between threads as necessary. In addition, both Sender and Receiver may be cloned.

Examples

let (tx, rx) = flume::unbounded();

tx.send(42).unwrap();
assert_eq!(rx.recv().unwrap(), 42);