Struct opentelemetry::Key
source · pub struct Key(/* private fields */);
Expand description
The key part of attribute KeyValue pairs.
See the attribute naming spec for guidelines.
Implementations§
source§impl Key
impl Key
sourcepub fn new(value: impl Into<Key>) -> Self
pub fn new(value: impl Into<Key>) -> Self
Create a new Key
.
§Examples
use opentelemetry::Key;
use std::sync::Arc;
let key1 = Key::new("my_static_str");
let key2 = Key::new(String::from("my_owned_string"));
let key3 = Key::new(Arc::from("my_ref_counted_str"));
sourcepub const fn from_static_str(value: &'static str) -> Self
pub const fn from_static_str(value: &'static str) -> Self
Create a new const Key
.
sourcepub fn string(self, value: impl Into<StringValue>) -> KeyValue
pub fn string(self, value: impl Into<StringValue>) -> KeyValue
Create a KeyValue
pair for string-like values.
Trait Implementations§
source§impl Ord for Key
impl Ord for Key
source§impl PartialOrd for Key
impl PartialOrd for Key
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)