pd::metrics

Type Alias SharedString

pub type SharedString = Cow<'static, str>;
Expand description

An allocation-optimized string.

SharedString uses a custom copy-on-write implementation that is optimized for metric keys, providing ergonomic sharing of single instances, or slices, of strings and labels. This copy-on-write implementation is optimized to allow for constant-time construction (using static values), as well as accepting owned values and values shared through Arc<T>.

End users generally will not need to interact with this type directly, as the top-level macros (counter!, etc), as well as the various conversion implementations (From<T>), generally allow users to pass whichever variant of a value (static, owned, shared) is best for them.

Aliased Typeยง

struct SharedString { /* private fields */ }