pub struct EventRing<const N: usize> { /* private fields */ }Expand description
A fixed-capacity SPSC ring of N slots (usable capacity N - 1).
Implementations§
Source§impl<const N: usize> EventRing<N>
impl<const N: usize> EventRing<N>
Sourcepub const fn capacity(&self) -> usize
pub const fn capacity(&self) -> usize
Usable capacity (one slot is reserved as the full/empty sentinel).
Sourcepub fn push(&self, event: TimedEvent) -> Result<(), TimedEvent>
pub fn push(&self, event: TimedEvent) -> Result<(), TimedEvent>
Producer side: enqueue an event. Returns the event back as Err if the
ring is full. Wait-free and allocation-free.
Sourcepub fn pop(&self) -> Option<TimedEvent>
pub fn pop(&self) -> Option<TimedEvent>
Consumer side: dequeue the oldest event, or None if empty. Wait-free.
Trait Implementations§
impl<const N: usize> Sync for EventRing<N>
Auto Trait Implementations§
impl<const N: usize> !Freeze for EventRing<N>
impl<const N: usize> !RefUnwindSafe for EventRing<N>
impl<const N: usize> Send for EventRing<N>
impl<const N: usize> Unpin for EventRing<N>
impl<const N: usize> UnsafeUnpin for EventRing<N>
impl<const N: usize> UnwindSafe for EventRing<N>
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