pub struct Producer<T> { /* private fields */ }Expand description
A handle to the queue which allows adding values onto the buffer
Implementations§
Source§impl<T> Producer<T>
impl<T> Producer<T>
Sourcepub fn try_push(&self, v: T) -> Option<T>
pub fn try_push(&self, v: T) -> Option<T>
Attempt to push a value onto the buffer.
This method does not block. If the queue is not full, the value will be
added to the queue and the method will return None, signifying
success. If the queue is full, this method will return Some(v)``, where v` is your original value.
Sourcepub fn disconnect(&self) -> bool
pub fn disconnect(&self) -> bool
Disconnects the producer, signaling to the consumer that no new values are going to be produced.
Returns the buffer status before the disconnect
Sourcepub fn consumer_disconnected(&self) -> bool
pub fn consumer_disconnected(&self) -> bool
Whether the associated consumer is disconnected.
Sourcepub fn free_space(&self) -> usize
pub fn free_space(&self) -> usize
Returns the available space in the queue
This value represents the number of items that can be pushed onto the queue before it becomes full.
Trait Implementations§
impl<T: Send> Send for Producer<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Producer<T>
impl<T> !Sync for Producer<T>
impl<T> !UnwindSafe for Producer<T>
impl<T> Freeze for Producer<T>
impl<T> Unpin for Producer<T>
impl<T> UnsafeUnpin 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