pub struct Producer<T> { /* private fields */ }Expand description
The producer endpoint of an MPSC queue.
This endpoint can be cloned to create additional producers. Each clone maintains its own cached state for performance.
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.
This method spins internally on CAS contention but returns immediately when the queue is actually full.
Sourcepub fn is_disconnected(&self) -> bool
pub fn is_disconnected(&self) -> bool
Returns true if the consumer has been dropped.
With multiple producers, this returns true only when this is the
last handle (all other producers and the consumer are 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