pub struct CacheSnapshot {
pub name: String,
pub current_bytes: u64,
pub previous_max_bytes: u64,
pub new_max_bytes: u64,
pub hit_rate: Option<f64>,
}Expand description
Per-cache slice of a BudgetSnapshot.
Fields§
§name: StringCache name (Resizable::name).
current_bytes: u64Bytes currently held by the cache when the tick fired.
previous_max_bytes: u64Cap before this tick reapportioned.
new_max_bytes: u64Cap installed by this tick.
hit_rate: Option<f64>Most recent hit rate; None if no lookups yet.
Implementations§
Source§impl CacheSnapshot
impl CacheSnapshot
Sourcepub fn delta_bytes(&self) -> i64
pub fn delta_bytes(&self) -> i64
Signed cap change this tick (new_max_bytes − previous_max_bytes).
Negative on shrink, positive on grow, zero on hold or skip.
Logged as delta_bytes on each per-cache emission so
post-mortem analysis can grep for nonzero deltas directly
without doing arithmetic.
Returns i64::MAX / i64::MIN on extreme cases where the
difference would not fit in i64 — practically unreachable
(caps are bounded by MEMORY_BUDGET_TARGET_MIB, not u64::MAX)
but the saturation keeps the math total.
Trait Implementations§
Source§impl Clone for CacheSnapshot
impl Clone for CacheSnapshot
Source§fn clone(&self) -> CacheSnapshot
fn clone(&self) -> CacheSnapshot
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 moreAuto Trait Implementations§
impl Freeze for CacheSnapshot
impl RefUnwindSafe for CacheSnapshot
impl Send for CacheSnapshot
impl Sync for CacheSnapshot
impl Unpin for CacheSnapshot
impl UnsafeUnpin for CacheSnapshot
impl UnwindSafe for CacheSnapshot
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