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>
impl<T: Send, const CAPACITY: usize> LockFreeProducer<T> for SPSCProducer<T, CAPACITY>
Source§fn lock_free_maybe_push(&self, value: T) -> Result<(), LockFreePushErr<T>>
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 moreSource§impl<T: Send, const CAPACITY: usize> Producer<T> for SPSCProducer<T, CAPACITY>
impl<T: Send, const CAPACITY: usize> Producer<T> for SPSCProducer<T, CAPACITY>
Source§fn maybe_push(&self, value: T) -> Result<(), T>
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 free_slots(&self) -> usize
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>
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>
unsafe fn lock_free_maybe_push_many( &self, slice: &[T], ) -> Result<(), LockFreePushManyErr>
Pushes multiple values into the queue or returns
an
Err(LockFreePushManyErr). Read moreSource§impl<T: Send, const CAPACITY: usize> SingleProducer<T> for SPSCProducer<T, CAPACITY>
impl<T: Send, const CAPACITY: usize> SingleProducer<T> for SPSCProducer<T, CAPACITY>
Source§unsafe fn push_many_unchecked(&self, first: &[T], last: &[T])
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<(), ()>
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>
unsafe fn copy_and_commit_if<F, FSuccess, FError>( &self, right: &[T], left: &[T], f: F, ) -> 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 moreimpl<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> 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