pub struct BufferStats {
pub writes: u64,
pub reads: u64,
pub underflows: u64,
pub overflows: u64,
pub fill_level: f32,
pub peak_fill: f32,
}Expand description
Buffer statistics snapshot for monitoring and debugging
This struct provides a read-only snapshot of buffer performance metrics.
It’s typically obtained via Buffer::stats().
Fields§
§writes: u64Total number of successful write operations
reads: u64Total number of successful read operations
underflows: u64Number of underflow events (read when empty)
overflows: u64Number of overflow events (write when full)
fill_level: f32Current fill level (0.0 to 1.0)
peak_fill: f32Peak fill level since last reset (0.0 to 1.0)
Implementations§
Source§impl BufferStats
impl BufferStats
Sourcepub fn new() -> BufferStats
pub fn new() -> BufferStats
Create a new zeroed statistics snapshot
Sourcepub fn success_rate(&self) -> f32
pub fn success_rate(&self) -> f32
Calculate the success rate (reads / writes)
Returns 1.0 if no writes, otherwise reads/writes.
Sourcepub fn error_rate(&self) -> f32
pub fn error_rate(&self) -> f32
Calculate the error rate (underflows + overflows) / operations
Trait Implementations§
Source§impl Clone for BufferStats
impl Clone for BufferStats
Source§fn clone(&self) -> BufferStats
fn clone(&self) -> BufferStats
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BufferStats
impl Debug for BufferStats
Source§impl Default for BufferStats
impl Default for BufferStats
Source§fn default() -> BufferStats
fn default() -> BufferStats
Returns the “default value” for a type. Read more
impl Copy for BufferStats
Auto Trait Implementations§
impl Freeze for BufferStats
impl RefUnwindSafe for BufferStats
impl Send for BufferStats
impl Sync for BufferStats
impl Unpin for BufferStats
impl UnsafeUnpin for BufferStats
impl UnwindSafe for BufferStats
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