[][src]Function flume::channel

pub fn channel<T: Send + 'static>() -> (Sender<T>, Receiver<T>)

Create a new channel.

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 threads as necessary. In addition, Sender may be cloned.

Examples

let (tx, rx) = flume::channel::<u32>();

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