pub struct RingBuf<const N: usize> { /* private fields */ }Expand description
Fixed-size ring buffer.
Designed for use with PageWriter where N = 2 * PAGE_SIZE.
When consumed in PAGE_SIZE-aligned chunks, peek always returns
a contiguous slice (no wrap on the read side).
Implementations§
Source§impl<const N: usize> RingBuf<N>
impl<const N: usize> RingBuf<N>
Sourcepub fn push(&mut self, data: &[u8]) -> usize
pub fn push(&mut self, data: &[u8]) -> usize
Push bytes into the buffer, handling wrap-around. Returns the number of bytes actually written (short if full).
Trait Implementations§
Auto Trait Implementations§
impl<const N: usize> Freeze for RingBuf<N>
impl<const N: usize> RefUnwindSafe for RingBuf<N>
impl<const N: usize> Send for RingBuf<N>
impl<const N: usize> Sync for RingBuf<N>
impl<const N: usize> Unpin for RingBuf<N>
impl<const N: usize> UnsafeUnpin for RingBuf<N>
impl<const N: usize> UnwindSafe for RingBuf<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