pub struct BoundedRing<T> { /* private fields */ }Expand description
A FIFO queue capped at cap items; a push into a full ring evicts the oldest.
Implementations§
Source§impl<T> BoundedRing<T>
impl<T> BoundedRing<T>
Sourcepub fn push(&mut self, item: T) -> Option<T>
pub fn push(&mut self, item: T) -> Option<T>
Enqueue item. If the ring is already full, the OLDEST item is evicted first (and counted
in dropped); the evicted item is returned so the caller can telemeter it.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_full(&self) -> bool
pub fn capacity(&self) -> usize
Trait Implementations§
Source§impl<T: Clone> Clone for BoundedRing<T>
impl<T: Clone> Clone for BoundedRing<T>
Source§fn clone(&self) -> BoundedRing<T>
fn clone(&self) -> BoundedRing<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 BoundedRing<T>
impl<T> RefUnwindSafe for BoundedRing<T>where
T: RefUnwindSafe,
impl<T> Send for BoundedRing<T>where
T: Send,
impl<T> Sync for BoundedRing<T>where
T: Sync,
impl<T> Unpin for BoundedRing<T>where
T: Unpin,
impl<T> UnsafeUnpin for BoundedRing<T>
impl<T> UnwindSafe for BoundedRing<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