pub struct MetricCounter { /* private fields */ }Expand description
Monotonically increasing counter (atomic u64).
Counters only go up — use them for totals like “operations completed” or “bytes transferred”. Thread-safe via relaxed atomic operations.
§Examples
use grafos_observe::MetricCounter;
let c = MetricCounter::new();
c.inc();
c.add(10);
assert_eq!(c.get(), 11);
let prev = c.reset();
assert_eq!(prev, 11);
assert_eq!(c.get(), 0);Implementations§
Source§impl MetricCounter
impl MetricCounter
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MetricCounter
impl RefUnwindSafe for MetricCounter
impl Send for MetricCounter
impl Sync for MetricCounter
impl Unpin for MetricCounter
impl UnwindSafe for MetricCounter
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