Module metrics::atomics

source ·
Expand description

Atomic types used for metrics.

As the most commonly used types for metrics storage are atomic integers, implementations of CounterFn and GaugeFn must be provided in this crate due to Rust’s “orphan rules”, which disallow a crate from implementing a foreign trait on a foreign type.

Further, we always require an atomic integer of a certain size regardless of whether the standard library exposes an atomic integer of that size for the target architecture.

As such, the atomic types that we provide handle implementations for are publicly re-exporter here for downstream crates to utilize.


  • An integer type which can be safely shared between threads.