pub struct Gauge(/* private fields */);Expand description
A gauge — a value that goes up and down, like the number of connected sessions.
Implementations§
Source§impl Gauge
impl Gauge
pub fn incr(&self)
pub fn decr(&self)
pub fn set(&self, n: u64)
Sourcepub fn adjust(&self, was: u64, now: u64)
pub fn adjust(&self, was: u64, now: u64)
Replace one contributor’s share: subtract what it held, add what it holds now.
A gauge that aggregates over many things — the entries every connected subscription is
arranging — cannot be set by any one of them, and re-summing them all on every render is
the scan the number exists to avoid. Saturating, because a contributor that reports its
departure twice must not wrap the gauge to u64::MAX.
pub fn get(&self) -> u64
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Gauge
impl RefUnwindSafe for Gauge
impl Send for Gauge
impl Sync for Gauge
impl Unpin for Gauge
impl UnwindSafe for Gauge
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