pub struct VolatileMemory { /* private fields */ }Expand description
Volatile memory ring retaining the most recent records.
Implementations§
Source§impl VolatileMemory
impl VolatileMemory
Sourcepub fn new(config: VolatileConfig) -> Self
pub fn new(config: VolatileConfig) -> Self
Creates a new buffer using the supplied configuration.
Sourcepub async fn push(&self, record: MemoryRecord)
pub async fn push(&self, record: MemoryRecord)
Inserts a record, evicting the oldest entries if capacity constraints are exceeded.
Sourcepub async fn recent(&self, limit: usize) -> Vec<MemoryRecord>
pub async fn recent(&self, limit: usize) -> Vec<MemoryRecord>
Returns the most recent records up to the requested limit.
Sourcepub async fn stats(&self) -> VolatileStats
pub async fn stats(&self) -> VolatileStats
Returns statistics about the buffer utilisation.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for VolatileMemory
impl !RefUnwindSafe for VolatileMemory
impl Send for VolatileMemory
impl Sync for VolatileMemory
impl Unpin for VolatileMemory
impl UnwindSafe for VolatileMemory
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