pub struct MemoryGauge { /* private fields */ }Expand description
Producer-side handle to an AtomicReporter’s gauge.
Cheap to clone (one Arc). Threaded into a subsystem so it can
publish its live footprint. A MemoryGauge::disconnected gauge
writes to a private atomic nobody reads — handy so subsystem code
always has a gauge to write to even when not running under a
registered budget (tests or applications without a budget).
Implementations§
Source§impl MemoryGauge
impl MemoryGauge
Sourcepub fn disconnected() -> Self
pub fn disconnected() -> Self
A gauge not wired to any reporter; updates go nowhere.
Sourcepub fn guard(&self, bytes: u64) -> GaugeGuard
pub fn guard(&self, bytes: u64) -> GaugeGuard
RAII attribution: add bytes to the gauge now and subtract the
same amount when the returned GaugeGuard drops. Hold one
alongside a resident allocation to attribute it to this gauge’s
reporter for exactly that allocation’s lifetime. Uses add/sub
so concurrent guards on the same reporter compose into one total.
Trait Implementations§
Source§impl Clone for MemoryGauge
impl Clone for MemoryGauge
Source§fn clone(&self) -> MemoryGauge
fn clone(&self) -> MemoryGauge
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 MemoryGauge
impl RefUnwindSafe for MemoryGauge
impl Send for MemoryGauge
impl Sync for MemoryGauge
impl Unpin for MemoryGauge
impl UnsafeUnpin for MemoryGauge
impl UnwindSafe for MemoryGauge
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