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>
impl<T> Sync for CircularBuffer<T>
impl<T> Unpin for CircularBuffer<T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Consume a handle, getting back the initial
Arc<> Read more