SPSCProducer

Struct SPSCProducer 

Source
pub struct SPSCProducer<T: Send, const CAPACITY: usize> { /* private fields */ }
Expand description

The producer of the SPSCBoundedQueue.

Trait Implementations§

Source§

impl<T: Send, const CAPACITY: usize> LockFreeProducer<T> for SPSCProducer<T, CAPACITY>

Source§

fn lock_free_maybe_push(&self, value: T) -> Result<(), LockFreePushErr<T>>

Pushes a value only if the queue is not full. On failure, returns Err(LockFreePushErr). Read more
Source§

impl<T: Send, const CAPACITY: usize> Producer<T> for SPSCProducer<T, CAPACITY>

Source§

fn capacity(&self) -> usize

Returns the capacity of the queue.
Source§

fn len(&self) -> usize

Returns the length of the queue.
Source§

fn maybe_push(&self, value: T) -> Result<(), T>

Pushes a value only if the queue is not full. It returns an error if the queue is full. Read more
Source§

fn is_empty(&self) -> bool

Returns whether the queue is empty.
Source§

fn free_slots(&self) -> usize

Returns the number of free slots in the queue.
Source§

impl<T: Send, const CAPACITY: usize> SingleLockFreeProducer<T> for SPSCProducer<T, CAPACITY>

Source§

unsafe fn lock_free_maybe_push_many( &self, slice: &[T], ) -> Result<(), LockFreePushManyErr>

Pushes multiple values into the queue or returns an Err(LockFreePushManyErr). Read more
Source§

impl<T: Send, const CAPACITY: usize> SingleProducer<T> for SPSCProducer<T, CAPACITY>

Source§

unsafe fn push_many_unchecked(&self, first: &[T], last: &[T])

Pushes multiple values into the queue. It accepts two slices to allow using it for ring-based queues. Read more
Source§

unsafe fn maybe_push_many(&self, slice: &[T]) -> Result<(), ()>

Pushes multiple values into the queue or returns an error if the queue doesn’t have enough space. Read more
Source§

unsafe fn copy_and_commit_if<F, FSuccess, FError>( &self, right: &[T], left: &[T], f: F, ) -> Result<FSuccess, FError>
where F: FnOnce() -> Result<FSuccess, FError>,

Copies values, calls the provided function and commits the values if the function returns true. It returns an error if the function returns an error and doesn’t commit the values (caller must ensure that their destructors are called). Read more
Source§

impl<T: Send, const CAPACITY: usize> Send for SPSCProducer<T, CAPACITY>

Auto Trait Implementations§

§

impl<T, const CAPACITY: usize> Freeze for SPSCProducer<T, CAPACITY>

§

impl<T, const CAPACITY: usize> !RefUnwindSafe for SPSCProducer<T, CAPACITY>

§

impl<T, const CAPACITY: usize> !Sync for SPSCProducer<T, CAPACITY>

§

impl<T, const CAPACITY: usize> Unpin for SPSCProducer<T, CAPACITY>

§

impl<T, const CAPACITY: usize> !UnwindSafe for SPSCProducer<T, CAPACITY>

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.