pub struct RingBuffer<T> { /* private fields */ }Expand description
A fixed-size ring buffer for storing recent items
Implementations§
Source§impl<T> RingBuffer<T>
impl<T> RingBuffer<T>
Sourcepub fn iter_recent(&self) -> impl Iterator<Item = &T>
pub fn iter_recent(&self) -> impl Iterator<Item = &T>
Iterate over items (most recent first)
Sourcepub fn to_vec_recent(&self) -> Vec<T>where
T: Clone,
pub fn to_vec_recent(&self) -> Vec<T>where
T: Clone,
Get all items as a vector (most recent first)
Trait Implementations§
Source§impl<T: Clone> Clone for RingBuffer<T>
impl<T: Clone> Clone for RingBuffer<T>
Source§fn clone(&self) -> RingBuffer<T>
fn clone(&self) -> RingBuffer<T>
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 moreAuto Trait Implementations§
impl<T> Freeze for RingBuffer<T>
impl<T> RefUnwindSafe for RingBuffer<T>where
T: RefUnwindSafe,
impl<T> Send for RingBuffer<T>where
T: Send,
impl<T> Sync for RingBuffer<T>where
T: Sync,
impl<T> Unpin for RingBuffer<T>where
T: Unpin,
impl<T> UnsafeUnpin for RingBuffer<T>
impl<T> UnwindSafe for RingBuffer<T>where
T: UnwindSafe,
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