Struct KeyValue
pub struct KeyValue<'a> {
pub key: Cow<'a, str>,
pub value: Value<'a>,
}
Expand description
A key-value attribute pair used in telemetry data.
Key-value pairs provide additional context for spans, events, and log messages. The key is typically a string identifier, and the value can be one of several supported data types.
§Examples
use veecle_telemetry::types::StringType;
use veecle_telemetry::{KeyValue, Value};
// Create attributes with different value types
let user_id = KeyValue::new("user_id", 123);
let username = KeyValue::new("username", "alice");
let is_active = KeyValue::new("is_active", true);
let score = KeyValue::new("score", 95.5);
Fields§
§key: Cow<'a, str>
The attribute key (name)
value: Value<'a>
The attribute value
Implementations§
Trait Implementations§
§impl<'de, 'a> Deserialize<'de> for KeyValue<'a>where
'de: 'a,
impl<'de, 'a> Deserialize<'de> for KeyValue<'a>where
'de: 'a,
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<KeyValue<'a>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<KeyValue<'a>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<'a> Serialize for KeyValue<'a>
impl<'a> Serialize for KeyValue<'a>
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl<'a> Freeze for KeyValue<'a>
impl<'a> RefUnwindSafe for KeyValue<'a>
impl<'a> Send for KeyValue<'a>
impl<'a> Sync for KeyValue<'a>
impl<'a> Unpin for KeyValue<'a>
impl<'a> UnwindSafe for KeyValue<'a>
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