pub fn queue<T>(
capacity: usize,
) -> (Reader<HeapBuffer<T>>, Writer<HeapBuffer<T>>)where
T: Default,
Available on crate features
nonblocking
and heap-buffer
only.Expand description
Creates a queue with a specific capacity, allocating storage on the heap. The queue will be initialized with an empty read buffer and a full write buffer containing the element’s default value.
Note that the reader and writer will only implement Send
and Sync
if the element
type also does.
§Example
use mini_io_queue::nonblocking::queue;
let (reader, writer) = queue::<u8>(100);