Skip to main content

memory_bounded_channel

Function memory_bounded_channel 

Source
pub fn memory_bounded_channel<T: InMemorySize>(
    max_bytes: usize,
    scope: &'static str,
) -> (MemoryBoundedSender<T>, MemoryBoundedReceiver<T>)
Available on crate feature common only.
Expand description

Creates a new memory-bounded channel with the given byte budget.

The budget tracks bytes currently buffered in the channel; it is reserved on MemoryBoundedSender::try_send and released as soon as the receiver dequeues the message.