Struct heapless::spsc::Producer [−][src]
pub struct Producer<'a, T, N, U = usize, C = MultiCore> where
N: ArrayLength<T>,
U: Uxx,
C: XCore, { /* fields omitted */ }
Expand description
A queue “producer”; it can enqueue items into the queue
Implementations
Returns if there is any space to enqueue a new item. When this returns true, at least the first subsequent enqueue will succeed.
Adds an item
to the end of the queue
Returns back the item
if the queue is full
Returns the number of elements in the queue
Note
This is a conservative estimate. Interrupt during this function
might cause that the Producer
actually has more than N items of available space.
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.
Returns if there is any space to enqueue a new item. When this returns true, at least the first subsequent enqueue will succeed.
Adds an item
to the end of the queue
Returns back the item
if the queue is full
Returns the number of elements in the queue
Note
This is a conservative estimate. Interrupt during this function
might cause that the Producer
actually has more than N items of available space.
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.
Returns if there is any space to enqueue a new item. When this returns true, at least the first subsequent enqueue will succeed.
Adds an item
to the end of the queue
Returns back the item
if the queue is full
Returns the number of elements in the queue
Note
This is a conservative estimate. Interrupt during this function
might cause that the Producer
actually has more than N items of available space.
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.
Trait Implementations
impl<'a, T, N, U, C> Send for Producer<'a, T, N, U, C> where
N: ArrayLength<T>,
T: Send,
U: Uxx,
C: XCore,
Auto Trait Implementations
impl<'a, T, N, U, C> Unpin for Producer<'a, T, N, U, C>
Blanket Implementations
pub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
pub fn from(t: T) -> T
pub fn from(t: T) -> T
Performs the conversion.
pub fn into(self) -> U
pub fn into(self) -> U
Performs the conversion.