pub struct LossyQueue<T> { /* private fields */ }Expand description
MPSC wait-free lossy ring buffer.
Implementations§
Source§impl<T> LossyQueue<T>
impl<T> LossyQueue<T>
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Create a new queue with the given capacity (must be a power of two).
Sourcepub fn try_send(&self, item: T) -> Result<(), T>
pub fn try_send(&self, item: T) -> Result<(), T>
Worker path — try to enqueue an item.
Uses FAA to claim a slot index, then CAS EMPTY→WRITING as a physical
gate. If the slot is occupied (ring buffer lapped or concurrent writer),
returns Err(item) immediately — never blocks.
Sourcepub fn send_blocking(&self, item: T)
pub fn send_blocking(&self, item: T)
Blocking send for critical commands (Sync, Clear). Spins until the item is successfully enqueued.
Trait Implementations§
Source§impl<T> Drop for LossyQueue<T>
impl<T> Drop for LossyQueue<T>
impl<T: Send> Send for LossyQueue<T>
impl<T: Send> Sync for LossyQueue<T>
Auto Trait Implementations§
impl<T> !Freeze for LossyQueue<T>
impl<T> !RefUnwindSafe for LossyQueue<T>
impl<T> Unpin for LossyQueue<T>
impl<T> UnsafeUnpin for LossyQueue<T>
impl<T> UnwindSafe for LossyQueue<T>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