pub struct CircularBuffer<T> {
buffer: Mutex<VecDeque<T>>,
capacity: usize,
}Expand description
A thread-safe circular buffer with FIFO eviction.
When the buffer reaches its capacity, the oldest items are automatically removed to make room for new ones.
Fields§
§buffer: Mutex<VecDeque<T>>§capacity: usizeImplementations§
Source§impl<T> CircularBuffer<T>
impl<T> CircularBuffer<T>
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for CircularBuffer<T>
impl<T> RefUnwindSafe for CircularBuffer<T>
impl<T> Send for CircularBuffer<T>where
T: Send,
impl<T> Sync for CircularBuffer<T>where
T: Send,
impl<T> Unpin for CircularBuffer<T>where
T: Unpin,
impl<T> UnsafeUnpin for CircularBuffer<T>
impl<T> UnwindSafe for CircularBuffer<T>
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