pub struct RingArrayBuf<const N: usize> { /* private fields */ }Available on crate feature
extend only.Expand description
A generic ring buffer implementation using arrays of the size of the power of two as internal buffers.
N must be a power of 2.
Trait Implementations§
Source§impl<const N: usize> Clone for RingArrayBuf<N>
impl<const N: usize> Clone for RingArrayBuf<N>
Source§fn clone(&self) -> RingArrayBuf<N>
fn clone(&self) -> RingArrayBuf<N>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<const N: usize> Debug for RingArrayBuf<N>
impl<const N: usize> Debug for RingArrayBuf<N>
Source§impl<const N: usize> Default for RingArrayBuf<N>
impl<const N: usize> Default for RingArrayBuf<N>
Source§fn default() -> Self
fn default() -> Self
The ring buffer is filled with zeros to match Zeroable::zeroed().
Source§impl<const N: usize> RingBuffer for RingArrayBuf<N>
impl<const N: usize> RingBuffer for RingArrayBuf<N>
Source§const BUFFER_SIZE: usize = N
const BUFFER_SIZE: usize = N
The size of the internal buffer in bytes.
Source§fn initialize(&mut self, byte: u8)
fn initialize(&mut self, byte: u8)
Initialize the ring buffer by filling it up with the given
byte value.Source§fn initialize_with(&mut self, init: impl FnOnce(&mut [u8]))
fn initialize_with(&mut self, init: impl FnOnce(&mut [u8]))
Initialize the ring buffer using a custom function that should fill it
with predetermined values.
Source§fn set_cursor(&mut self, pos: isize)
fn set_cursor(&mut self, pos: isize)
Set the current value of the internal cursor. Read more
Source§fn push(&mut self, byte: u8)
fn push(&mut self, byte: u8)
Push the new byte value to the buffer, overwriting the oldest one and
advance the ring buffer cursor.
Source§fn iter_from_offset(&mut self, offset: usize) -> HistoryIter<'_, Self> ⓘ
fn iter_from_offset(&mut self, offset: usize) -> HistoryIter<'_, Self> ⓘ
Return an iterator which will yield consecutive bytes from the buffer
starting at
-offset from the last element. Read moreSource§fn iter_from_index(&mut self, pos: usize) -> HistoryIter<'_, Self> ⓘ
fn iter_from_index(&mut self, pos: usize) -> HistoryIter<'_, Self> ⓘ
Return an iterator which will yield consecutive bytes from the buffer
starting from the absolute buffer
index. Read moreAuto Trait Implementations§
impl<const N: usize> Freeze for RingArrayBuf<N>
impl<const N: usize> RefUnwindSafe for RingArrayBuf<N>
impl<const N: usize> Send for RingArrayBuf<N>
impl<const N: usize> Sync for RingArrayBuf<N>
impl<const N: usize> Unpin for RingArrayBuf<N>
impl<const N: usize> UnsafeUnpin for RingArrayBuf<N>
impl<const N: usize> UnwindSafe for RingArrayBuf<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