pub struct RingBuffer { /* private fields */ }Expand description
A ring buffer that maintains a fixed maximum size
Implementations§
Source§impl RingBuffer
impl RingBuffer
Sourcepub fn write(&mut self, data: &[u8])
pub fn write(&mut self, data: &[u8])
Write data to the ring buffer
If the buffer would exceed max_bytes, old data is dropped from the front.
Sourcepub const fn total_bytes_written(&self) -> usize
pub const fn total_bytes_written(&self) -> usize
Get the total number of bytes written (including truncated bytes)
Sourcepub const fn was_truncated(&self) -> bool
pub const fn was_truncated(&self) -> bool
Check if any data was truncated
Trait Implementations§
Source§impl Clone for RingBuffer
impl Clone for RingBuffer
Source§fn clone(&self) -> RingBuffer
fn clone(&self) -> RingBuffer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RingBuffer
impl Debug for RingBuffer
Auto Trait Implementations§
impl Freeze for RingBuffer
impl RefUnwindSafe for RingBuffer
impl Send for RingBuffer
impl Sync for RingBuffer
impl Unpin for RingBuffer
impl UnsafeUnpin for RingBuffer
impl UnwindSafe for RingBuffer
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