Skip to main content

SpscConsumer

Struct SpscConsumer 

Source
pub struct SpscConsumer<T, Codec, const BYTES: usize> { /* private fields */ }
Expand description

The only consumer endpoint for a mailbox.

The endpoint is Send but not Sync. Its operations use a bounded number of lock-free atomic loads and stores.

Implementations§

Source§

impl<T, Codec, const BYTES: usize> SpscConsumer<T, Codec, BYTES>
where T: Copy + Send + Sync + 'static, Codec: SpscCodec<T, BYTES>,

Source

pub fn try_peek(&mut self) -> Result<T, SpscPopError>

Returns the current value without permitting slot reuse.

Repeated calls return the same value. Call commit_peeked only after the downstream consumer accepts the value.

Source

pub fn commit_peeked(&mut self) -> Result<SpscCommitOutcome, SpscCommitError>

Consumes the value returned by try_peek.

The release store permits the producer to reuse this slot. An invalid payload can also be committed so later values remain accessible.

Source

pub fn try_pop(&mut self) -> Result<T, SpscPopError>

Source

pub fn capacity(&self) -> usize

Source

pub fn approximate_len(&self) -> usize

Source

pub fn counters(&self) -> SpscCounters

Source

pub fn is_producer_connected(&self) -> bool

Trait Implementations§

Source§

impl<T, Codec, const BYTES: usize> Drop for SpscConsumer<T, Codec, BYTES>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<T, Codec, const BYTES: usize> !RefUnwindSafe for SpscConsumer<T, Codec, BYTES>

§

impl<T, Codec, const BYTES: usize> !Sync for SpscConsumer<T, Codec, BYTES>

§

impl<T, Codec, const BYTES: usize> Freeze for SpscConsumer<T, Codec, BYTES>
where Arc<Shared<T, Codec, BYTES>>: Freeze, PeekedPayload<T>: Freeze,

§

impl<T, Codec, const BYTES: usize> Send for SpscConsumer<T, Codec, BYTES>
where Arc<Shared<T, Codec, BYTES>>: Send, PeekedPayload<T>: Send,

§

impl<T, Codec, const BYTES: usize> Unpin for SpscConsumer<T, Codec, BYTES>
where Arc<Shared<T, Codec, BYTES>>: Unpin, PeekedPayload<T>: Unpin,

§

impl<T, Codec, const BYTES: usize> UnsafeUnpin for SpscConsumer<T, Codec, BYTES>
where Arc<Shared<T, Codec, BYTES>>: UnsafeUnpin, PeekedPayload<T>: UnsafeUnpin,

§

impl<T, Codec, const BYTES: usize> UnwindSafe for SpscConsumer<T, Codec, BYTES>
where Arc<Shared<T, Codec, BYTES>>: UnwindSafe, PeekedPayload<T>: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more