pub struct RingBuffer { /* private fields */ }Expand description
A fixed-capacity circular buffer of ProbeResults.
When the buffer is full, the oldest entry is evicted.
Implementations§
Source§impl RingBuffer
impl RingBuffer
Sourcepub fn push(&mut self, result: ProbeResult)
pub fn push(&mut self, result: ProbeResult)
Push a new probe result, evicting the oldest if at capacity.
Sourcepub fn snapshot(&self) -> Vec<ProbeResult>
pub fn snapshot(&self) -> Vec<ProbeResult>
Return a snapshot of all current samples as a Vec. This is a clone — callers get their own data and the lock is released as soon as the borrow ends.
Auto Trait Implementations§
impl Freeze for RingBuffer
impl RefUnwindSafe for RingBuffer
impl Send for RingBuffer
impl Sync for RingBuffer
impl Unpin for RingBuffer
impl UnsafeUnpin for RingBuffer
impl UnwindSafe for RingBuffer
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more