pub struct RingSource<const SLOTS: usize, const SLOT: usize> { /* private fields */ }Expand description
A fixed-capacity ring of byte frames over a stack arena — the zero-copy *DK
source (DPDK mbuf ring / NVMe CQ view / per-core telemetry ring). Items lent
to the visitor borrow directly into arena; no heap, no copy on the read.
Implementations§
Source§impl<const SLOTS: usize, const SLOT: usize> RingSource<SLOTS, SLOT>
impl<const SLOTS: usize, const SLOT: usize> RingSource<SLOTS, SLOT>
pub const fn new() -> Self
Sourcepub fn push(&mut self, frame: &[u8]) -> bool
pub fn push(&mut self, frame: &[u8]) -> bool
Copy one frame into the next slot. false if full or oversized (the
producer’s concern — the ring never allocates).
Sourcepub fn close(&mut self)
pub fn close(&mut self)
No more frames will arrive — the next fully-drained pass returns
DrainState::Drained.
Trait Implementations§
Source§impl<const SLOTS: usize, const SLOT: usize> DrainSource for RingSource<SLOTS, SLOT>
impl<const SLOTS: usize, const SLOT: usize> DrainSource for RingSource<SLOTS, SLOT>
Source§fn drain_ready(
&mut self,
visitor: &mut dyn FnMut(&[u8]) -> ControlFlow<()>,
) -> DrainState
fn drain_ready( &mut self, visitor: &mut dyn FnMut(&[u8]) -> ControlFlow<()>, ) -> DrainState
Drain all currently-ready items, calling
visitor on each (borrowed)
item in order. No alloc, no syscall, no waker on the hot path.Auto Trait Implementations§
impl<const SLOTS: usize, const SLOT: usize> Freeze for RingSource<SLOTS, SLOT>
impl<const SLOTS: usize, const SLOT: usize> RefUnwindSafe for RingSource<SLOTS, SLOT>
impl<const SLOTS: usize, const SLOT: usize> Send for RingSource<SLOTS, SLOT>
impl<const SLOTS: usize, const SLOT: usize> Sync for RingSource<SLOTS, SLOT>
impl<const SLOTS: usize, const SLOT: usize> Unpin for RingSource<SLOTS, SLOT>
impl<const SLOTS: usize, const SLOT: usize> UnsafeUnpin for RingSource<SLOTS, SLOT>
impl<const SLOTS: usize, const SLOT: usize> UnwindSafe for RingSource<SLOTS, SLOT>
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