new

Function new 

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

Create a new ring buffer with the specified capacity

创建指定容量的新环形缓冲区

§Parameters

  • capacity: Desired capacity (will be rounded up to next power of 2)

§Returns

A tuple of (Producer, Consumer)

§Panics

Panics if capacity is 0

§参数

  • capacity: 期望容量(将向上取整到下一个 2 的幂次)

§返回值

返回 (Producer, Consumer) 元组

§Panics

如果容量为 0 则 panic