Skip to main content

RingSource

Struct RingSource 

Source
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>

Source

pub const fn new() -> Self

Source

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).

Source

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> Default for RingSource<SLOTS, SLOT>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<const SLOTS: usize, const SLOT: usize> DrainSource for RingSource<SLOTS, SLOT>

Source§

type Item = [u8]

The item lent to the visitor. ?Sized so it can be a [u8] slot view.
Source§

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>
where [[u8; SLOT]; SLOTS]: Freeze, [usize; SLOTS]: Freeze,

§

impl<const SLOTS: usize, const SLOT: usize> RefUnwindSafe for RingSource<SLOTS, SLOT>

§

impl<const SLOTS: usize, const SLOT: usize> Send for RingSource<SLOTS, SLOT>
where [[u8; SLOT]; SLOTS]: Send, [usize; SLOTS]: Send,

§

impl<const SLOTS: usize, const SLOT: usize> Sync for RingSource<SLOTS, SLOT>
where [[u8; SLOT]; SLOTS]: Sync, [usize; SLOTS]: Sync,

§

impl<const SLOTS: usize, const SLOT: usize> Unpin for RingSource<SLOTS, SLOT>
where [[u8; SLOT]; SLOTS]: Unpin, [usize; SLOTS]: Unpin,

§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more