pub struct RingBuffer<T, const N: usize> { /* private fields */ }Expand description
RingBuffer is a statically-allocated, typed ring buffer container.
This container is not thread safe.
Implementations§
Source§impl<T, const N: usize> RingBuffer<T, N>
impl<T, const N: usize> RingBuffer<T, N>
Sourcepub fn front_mut(&mut self) -> &mut T
pub fn front_mut(&mut self) -> &mut T
Returns a mutable reference to the oldest element in the buffer.
§Panics
Panics if the buffer is empty.
Sourcepub fn back_mut(&mut self) -> &mut T
pub fn back_mut(&mut self) -> &mut T
Returns a mutable reference to the newest element in the buffer.
§Panics
Panics if the buffer is empty.
Trait Implementations§
Source§impl<T, const N: usize> Default for RingBuffer<T, N>
impl<T, const N: usize> Default for RingBuffer<T, N>
Source§impl<T, const N: usize> Drop for RingBuffer<T, N>
impl<T, const N: usize> Drop for RingBuffer<T, N>
Auto Trait Implementations§
impl<T, const N: usize> Freeze for RingBuffer<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for RingBuffer<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for RingBuffer<T, N>where
T: Send,
impl<T, const N: usize> Sync for RingBuffer<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for RingBuffer<T, N>where
T: Unpin,
impl<T, const N: usize> UnsafeUnpin for RingBuffer<T, N>where
T: UnsafeUnpin,
impl<T, const N: usize> UnwindSafe for RingBuffer<T, N>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, U> Into<U> for Twhere
U: From<T>,
impl<T, U> Into<U> for Twhere
U: From<T>,
Source§impl<T> PinInit<T> for T
impl<T> PinInit<T> for T
Source§unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
unsafe fn __pinned_init(self, slot: *mut T) -> Result<(), Infallible>
Initializes
slot. Read moreSource§fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>where
F: FnOnce(Pin<&mut T>) -> Result<(), E>,
fn pin_chain<F>(self, f: F) -> ChainPinInit<Self, F, T, E>where
F: FnOnce(Pin<&mut T>) -> Result<(), E>,
First initializes the value using
self then calls the function f with the initialized
value. Read more