Skip to main content

new

Function new 

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

Creates a bounded single-producer single-consumer queue with the given capacity.

Returns the producer and the consumer side for the queue.

§Panics

Panics if the capacity is zero.

§Examples

use rustasim::spsc;

let (p, c) = spsc::new::<i32>(100);