pub struct RingBuf<T: Clone> { /* private fields */ }Expand description
Fixed-capacity ring buffer. Oldest entry is dropped when full.
Implementations§
Source§impl<T: Clone> RingBuf<T>
impl<T: Clone> RingBuf<T>
pub fn new(capacity: usize) -> Self
pub fn push(&mut self, value: T)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> usize
Sourcepub fn iter(&self) -> impl Iterator<Item = &T>
pub fn iter(&self) -> impl Iterator<Item = &T>
Returns a slice-like iterator over all values in insertion order.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for RingBuf<T>
impl<T> RefUnwindSafe for RingBuf<T>where
T: RefUnwindSafe,
impl<T> Send for RingBuf<T>where
T: Send,
impl<T> Sync for RingBuf<T>where
T: Sync,
impl<T> Unpin for RingBuf<T>where
T: Unpin,
impl<T> UnsafeUnpin for RingBuf<T>
impl<T> UnwindSafe for RingBuf<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