pub struct Producer<T> { /* private fields */ }Expand description
The producer endpoint of an SPMC queue.
This endpoint cannot be cloned - only one producer thread is allowed. The single-writer design eliminates CAS contention on the tail index.
Implementations§
Source§impl<T> Producer<T>
impl<T> Producer<T>
Sourcepub fn push(&mut self, value: T) -> Result<(), Full<T>>
pub fn push(&mut self, value: T) -> Result<(), Full<T>>
Pushes a value into the queue.
Returns Err(Full(value)) if the queue is full, returning ownership
of the value to the caller for backpressure handling.
No CAS required - single writer principle.
Sourcepub fn is_disconnected(&self) -> bool
pub fn is_disconnected(&self) -> bool
Returns true if all consumers have been dropped.
Trait Implementations§
impl<T: Send> Send for Producer<T>
Auto Trait Implementations§
impl<T> Freeze for Producer<T>
impl<T> !RefUnwindSafe for Producer<T>
impl<T> !Sync for Producer<T>
impl<T> Unpin for Producer<T>
impl<T> UnsafeUnpin for Producer<T>
impl<T> !UnwindSafe for Producer<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