pub struct Producer<'a, T, N, U = usize, C = MultiCore>where
N: ArrayLength<T>,
U: Uxx,
C: XCore,{ /* private fields */ }
Expand description
A queue “producer”; it can enqueue items into the queue
Implementations§
source§impl<'a, T, N, C> Producer<'a, T, N, usize, C>where
N: ArrayLength<T>,
C: XCore,
impl<'a, T, N, C> Producer<'a, T, N, usize, C>where
N: ArrayLength<T>,
C: XCore,
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.
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 it’s full
Unsafety
If the queue is full this operation will leak a value (T’s destructor won’t run on
the value that got overwritten by item
), and will allow the dequeue
operation
to create a copy of item
, which could result in T
’s destructor running on item
twice.