Skip to main content

BlockingMpscProducer

Struct BlockingMpscProducer 

Source
pub struct BlockingMpscProducer { /* private fields */ }
Expand description

A single producer handle. Sole writer to one underlying SPSC ring. !Sync + !Clone + Send: one producer per thread.

Implementations§

Source§

impl BlockingMpscProducer

Source

pub fn try_push(&self, payload: &[u8]) -> Result<(), RingError>

Non-blocking push. On success, increments the shared total_published counter and fires a wake at the consumer waker (cheap if no parked consumer).

Source

pub fn send_blocking( &self, payload: &[u8], timeout: Option<Duration>, ) -> Result<(), BlockingError>

Block until either push succeeds or timeout elapses. Producer parks on its OWN ring’s waker; the consumer’s pop-side wakes the right ring’s waker by try_pop_ring_blocking.

Source

pub fn capacity(&self) -> usize

This producer’s ring capacity (constant).

Source

pub fn head(&self) -> u64

This producer’s own publish head.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.