pub fn fast_channel<T>(capacity: usize) -> (Sender<T>, Receiver<T>)
Expand description

A fast MPMC message channel that can hold a fixed number of messages.

If the channel is full, the sender will block upon sending extra messages until the receiver has consumed some messages. The capacity parameter should be chosen either:

  • high enough to avoid blocking on the common cases,
  • or, on the contrary, using the blocking behavior as a means to prevent fast producers from building up work faster than it is consumed.