pub struct Producer<'a, T> { /* private fields */ }Expand description
A producer; it can enqueue items into the queue.
Note: The producer semantically owns the tail pointer of the queue.
Implementations§
Source§impl<T> Producer<'_, T>
impl<T> Producer<'_, T>
Sourcepub fn enqueue(&mut self, item: T) -> Result<(), T>
pub fn enqueue(&mut self, item: T) -> Result<(), T>
Adds an item to the end of the queue, returns back the item if the queue is full.
Sourcepub unsafe fn enqueue_unchecked(&mut self, item: T)
pub unsafe fn enqueue_unchecked(&mut self, item: T)
Adds an item to the end of the queue, without checking if the queue is full.
§Safety
Sourcepub fn ready(&self) -> bool
pub fn ready(&self) -> bool
Returns if there is any space to enqueue a new item. When this returns true, at least the first subsequent enqueue will succeed.