Skip to main content

ring

Function ring 

Source
pub fn ring<T: Send>(
    capacity: usize,
) -> Result<(Producer<T>, Consumer<T>), InvalidCapacity>
Expand description

Create an SPSC ring buffer with the given capacity (must be a power of 2).

Returns (Producer, Consumer) — send each half to its own thread.

§Errors

Returns InvalidCapacity if capacity is zero or not a power of two.