pub struct RingBuffer<const N: usize> { /* private fields */ }Expand description
Fixed-capacity byte ring buffer for variable-length packets.
Stores packets contiguously with a 2-byte length prefix.
When a packet doesn’t fit between the write cursor and the
buffer end, the gap is skipped and the packet wraps to
position 0. Worst case wastes MTU bytes once — same as one
Deque slot — but typical utilization is much better since
small packets pack tightly.
When the ring is full, push returns false and the
packet is dropped (tail-drop policy).
Implementations§
Auto Trait Implementations§
impl<const N: usize> Freeze for RingBuffer<N>
impl<const N: usize> RefUnwindSafe for RingBuffer<N>
impl<const N: usize> Send for RingBuffer<N>
impl<const N: usize> Sync for RingBuffer<N>
impl<const N: usize> Unpin for RingBuffer<N>
impl<const N: usize> UnsafeUnpin for RingBuffer<N>
impl<const N: usize> UnwindSafe for RingBuffer<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