pub struct Key { /* private fields */ }
Expand description
A metric key.
A key always includes a name, but can optional include multiple labels used to further describe the metric.
Implementations§
Source§impl Key
impl Key
Sourcepub fn from_name<N>(name: N) -> Selfwhere
N: Into<ScopedString>,
pub fn from_name<N>(name: N) -> Selfwhere
N: Into<ScopedString>,
Creates a Key
from a name.
Sourcepub fn from_name_and_labels<N, L>(name: N, labels: L) -> Self
pub fn from_name_and_labels<N, L>(name: N, labels: L) -> Self
Creates a Key
from a name and vector of Label
s.
Sourcepub fn add_labels<L>(&mut self, new_labels: L)where
L: IntoLabels,
pub fn add_labels<L>(&mut self, new_labels: L)where
L: IntoLabels,
Adds a new set of labels to this key.
New labels will be appended to any existing labels.
Sourcepub fn name(&self) -> ScopedString
pub fn name(&self) -> ScopedString
Name of this key.
Sourcepub fn into_parts(self) -> (ScopedString, Vec<Label>)
pub fn into_parts(self) -> (ScopedString, Vec<Label>)
Consumes this Key
, returning the name and any labels.
Trait Implementations§
Source§impl From<Cow<'static, str>> for Key
impl From<Cow<'static, str>> for Key
Source§fn from(name: ScopedString) -> Key
fn from(name: ScopedString) -> Key
Converts to this type from the input type.
impl Eq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
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