pub struct LockFreeQueue<T> { /* private fields */ }Expand description
Lock-free SPSC (Single Producer Single Consumer) queue
Optimized for low-latency real-time streaming with wait-free operations.
Implementations§
Source§impl<T> LockFreeQueue<T>
impl<T> LockFreeQueue<T>
Sourcepub fn push(&self, item: T) -> Result<(), T>
pub fn push(&self, item: T) -> Result<(), T>
Push an item to the queue (non-blocking)
Returns Err if the queue is full
Sourcepub fn try_push(&self, item: T) -> bool
pub fn try_push(&self, item: T) -> bool
Try to push an item, dropping it if queue is full
Returns true if the item was pushed, false if dropped
Sourcepub fn pop(&self) -> Option<T>
pub fn pop(&self) -> Option<T>
Pop an item from the queue (non-blocking)
Returns None if the queue is empty
Sourcepub fn dropped_count(&self) -> usize
pub fn dropped_count(&self) -> usize
Get number of dropped items (when queue was full)
Sourcepub fn reset_dropped_count(&self)
pub fn reset_dropped_count(&self)
Reset dropped count
Sourcepub fn clone_handle(&self) -> Self
pub fn clone_handle(&self) -> Self
Clone the queue handle (shares the same underlying queue)
Auto Trait Implementations§
impl<T> Freeze for LockFreeQueue<T>
impl<T> RefUnwindSafe for LockFreeQueue<T>
impl<T> Send for LockFreeQueue<T>where
T: Send,
impl<T> Sync for LockFreeQueue<T>where
T: Send,
impl<T> Unpin for LockFreeQueue<T>
impl<T> UnwindSafe for LockFreeQueue<T>
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
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more