pub struct SpscRing<T, const N: usize> { /* private fields */ }Expand description
Single-producer single-consumer ring.
One slot is reserved to distinguish full from empty, so the effective
capacity is N - 1.
Implementations§
Source§impl<T, const N: usize> SpscRing<T, N>
impl<T, const N: usize> SpscRing<T, N>
pub fn new() -> SpscRing<T, N>
pub fn capacity(&self) -> usize
pub fn push(&self, value: T) -> Result<(), T>
pub fn pop(&self) -> Option<T>
pub fn peek_copy(&self) -> Option<T>where
T: Copy,
pub fn is_empty(&self) -> bool
pub fn clear_consumer(&self)
pub fn len_snapshot(&self) -> usize
pub fn remaining_snapshot(&self) -> usize
Trait Implementations§
impl<T, const N: usize> Send for SpscRing<T, N>where
T: Send,
impl<T, const N: usize> Sync for SpscRing<T, N>where
T: Send,
Auto Trait Implementations§
impl<T, const N: usize> !Freeze for SpscRing<T, N>
impl<T, const N: usize> !RefUnwindSafe for SpscRing<T, N>
impl<T, const N: usize> Unpin for SpscRing<T, N>where
T: Unpin,
impl<T, const N: usize> UnsafeUnpin for SpscRing<T, N>where
T: UnsafeUnpin,
impl<T, const N: usize> UnwindSafe for SpscRing<T, N>where
T: UnwindSafe,
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