func channel_bounded<T>(capacity: Int) -> (BoundedSender<T>, Receiver<T>) where T: SendCreates a FIFO transfer channel with producer backpressure.
Capacities below one are clamped to one, so this is never a rendezvous channel. The returned receiver is the same single-consumer type used by unbounded channels.
View Source
pub func channel_bounded<T>(capacity: Int) -> (BoundedSender<T>, Receiver<T>) where T: Send {
let bound = if capacity < 1 { 1 } else { capacity }
let handle = _chan_ctl(handle: bound, op: 7)
(
BoundedSender(handle: handle, guard: _drop_token()),
Receiver(handle: handle, guard: _drop_token())
)
}