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.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for Producer<'a, T>
impl<'a, T> !RefUnwindSafe for Producer<'a, T>
impl<'a, T> !Sync for Producer<'a, T>
impl<'a, T> Unpin for Producer<'a, T>
impl<'a, T> !UnwindSafe for Producer<'a, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more