Enum opentelemetry::logs::AnyValue

source ·
#[non_exhaustive]
pub enum AnyValue { Int(i64), Double(f64), String(StringValue), Boolean(bool), Bytes(Box<Vec<u8>>), ListAny(Box<Vec<AnyValue>>), Map(Box<HashMap<Key, AnyValue>>), }
Expand description

Value types for representing arbitrary values in a log record. Note: The tracing and log crates only support basic types that can be converted to these core variants: i64, f64, StringValue, and bool. Any complex and custom types are supported through their Debug implementation, and converted to String. More complex types (Bytes, ListAny, and Map) are included here to meet specification requirements and are available to support custom appenders that may be implemented for other logging crates. These types allow for handling dynamic data structures, so keep in mind the potential performance overhead of using boxed vectors and maps in appenders.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Int(i64)

An integer value

§

Double(f64)

A double value

§

String(StringValue)

A string value

§

Boolean(bool)

A boolean value

§

Bytes(Box<Vec<u8>>)

A byte array

§

ListAny(Box<Vec<AnyValue>>)

An array of Any values

§

Map(Box<HashMap<Key, AnyValue>>)

A map of string keys to Any values, arbitrarily nested.

Trait Implementations§

source§

impl Clone for AnyValue

source§

fn clone(&self) -> AnyValue

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for AnyValue

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&'static str> for AnyValue

source§

fn from(val: &'static str) -> AnyValue

Converts to this type from the input type.
source§

impl From<Cow<'static, str>> for AnyValue

source§

fn from(val: Cow<'static, str>) -> AnyValue

Converts to this type from the input type.
source§

impl From<String> for AnyValue

source§

fn from(val: String) -> AnyValue

Converts to this type from the input type.
source§

impl From<StringValue> for AnyValue

source§

fn from(val: StringValue) -> AnyValue

Converts to this type from the input type.
source§

impl From<bool> for AnyValue

source§

fn from(val: bool) -> AnyValue

Converts to this type from the input type.
source§

impl From<f32> for AnyValue

source§

fn from(val: f32) -> AnyValue

Converts to this type from the input type.
source§

impl From<f64> for AnyValue

source§

fn from(val: f64) -> AnyValue

Converts to this type from the input type.
source§

impl From<i16> for AnyValue

source§

fn from(val: i16) -> AnyValue

Converts to this type from the input type.
source§

impl From<i32> for AnyValue

source§

fn from(val: i32) -> AnyValue

Converts to this type from the input type.
source§

impl From<i64> for AnyValue

source§

fn from(val: i64) -> AnyValue

Converts to this type from the input type.
source§

impl From<i8> for AnyValue

source§

fn from(val: i8) -> AnyValue

Converts to this type from the input type.
source§

impl From<u16> for AnyValue

source§

fn from(val: u16) -> AnyValue

Converts to this type from the input type.
source§

impl From<u32> for AnyValue

source§

fn from(val: u32) -> AnyValue

Converts to this type from the input type.
source§

impl From<u8> for AnyValue

source§

fn from(val: u8) -> AnyValue

Converts to this type from the input type.
source§

impl<K: Into<Key>, V: Into<AnyValue>> FromIterator<(K, V)> for AnyValue

source§

fn from_iter<I: IntoIterator<Item = (K, V)>>(iter: I) -> Self

Creates an AnyValue::Map value from a sequence of key-value pairs that can be converted into a Key and AnyValue respectively.

source§

impl<T: Into<AnyValue>> FromIterator<T> for AnyValue

source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates an AnyValue::ListAny value from a sequence of Into<AnyValue> values.

source§

impl PartialEq for AnyValue

source§

fn eq(&self, other: &AnyValue) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for AnyValue

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.