pub fn channel<T>(buffer: usize) -> (Sender<T>, Receiver<T>)Expand description
Creates a bounded mpsc channel for communicating between asynchronous tasks.
Being bounded, this channel provides backpressure to ensure that the sender
outpaces the receiver by only a limited amount. The channel’s capacity is
equal to buffer. In other words, there are
buffer “first come, first serve” slots available to all senders.
The Receiver returned implements the
Stream trait, while Sender
has its own method, send.