make

Function make 

Source
pub fn make<T>(min_capacity: usize) -> (Producer<T>, Consumer<T>)
Expand description

Creates a new SPSC Queue, returning a Producer and Consumer handle

Capacity specifies the size of the bounded queue to create. Actual memory usage will be capacity.next_power_of_two() * size_of::<T>(), since ringbuffers with power of two sizes are more efficient to operate on (can use a bitwise AND to index into the ring instead of a more expensive modulo operator).

Of course, a SPSC queue is really only useful if you plan to use it in a multi-threaded environment. The Producer and Consumer can both be sent to a thread, providing a fast, bounded one-way communication channel between those threads.

ยงPanics

If the requested queue size is larger than available memory (e.g. capacity.next_power_of_two() * size_of::<T>() > available memory ), this function will abort with an OOM panic.