File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ impl KeyName {
2323 pub fn as_str ( & self ) -> & str {
2424 & self . 0
2525 }
26+
27+ /// Consumes this [`KeyName`], returning the inner [`SharedString`].
28+ pub fn into_inner ( self ) -> SharedString {
29+ self . 0
30+ }
2631}
2732
2833impl < T > From < T > for KeyName
@@ -40,6 +45,12 @@ impl Borrow<str> for KeyName {
4045 }
4146}
4247
48+ impl From < KeyName > for std:: borrow:: Cow < ' static , str > {
49+ fn from ( name : KeyName ) -> Self {
50+ name. 0 . into ( )
51+ }
52+ }
53+
4354/// A metric identifier.
4455///
4556/// A key represents both the name and labels of a metric.
@@ -131,6 +142,11 @@ impl Key {
131142 self . name . 0 . as_ref ( )
132143 }
133144
145+ /// Name of this key as a [`KeyName`]
146+ pub fn name_shared ( & self ) -> KeyName {
147+ self . name . clone ( )
148+ }
149+
134150 /// Labels of this key, if they exist.
135151 pub fn labels ( & self ) -> Iter < ' _ , Label > {
136152 self . labels . iter ( )
You can’t perform that action at this time.
0 commit comments