pub struct Producer<T> { /* private fields */ }Expand description
The producer half of the ring buffer.
Lives on the Control Plane (Tokio). It is Send so it can be moved
between Tokio worker threads.
Implementations§
Source§impl<T> Producer<T>
impl<T> Producer<T>
Sourcepub fn try_push(&mut self, value: T) -> Result<()>
pub fn try_push(&mut self, value: T) -> Result<()>
Try to enqueue a value. Returns Err(BridgeError::Full) if the ring is full,
or Err(BridgeError::Disconnected) if the consumer was dropped.
Sourcepub fn utilization(&self) -> u8
pub fn utilization(&self) -> u8
Returns the current queue utilization as a percentage (0-100).
Sourcepub fn metrics(&self) -> &BridgeMetrics
pub fn metrics(&self) -> &BridgeMetrics
Returns a reference to the shared metrics.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Producer<T>
impl<T> !RefUnwindSafe for Producer<T>
impl<T> Send for Producer<T>where
T: Send,
impl<T> Sync for Producer<T>where
T: Send,
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