Struct opentelemetry_api::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_api::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
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Key
impl StructuralEq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.