Struct opentelemetry::trace::TraceState[][src]

pub struct TraceState(_);
This is supported on crate feature trace only.
Expand description

TraceState carries system-specific configuration data, represented as a list of key-value pairs. TraceState allows multiple tracing systems to participate in the same trace.

Please review the W3C specification for details on this field.

Implementations

Creates a new TraceState from the given key-value collection.

Examples

use opentelemetry::trace::{TraceState, TraceStateError};

let kvs = vec![("foo", "bar"), ("apple", "banana")];
let trace_state: Result<TraceState, TraceStateError> = TraceState::from_key_value(kvs);

assert!(trace_state.is_ok());
assert_eq!(trace_state.unwrap().header(), String::from("foo=bar,apple=banana"))

Retrieves a value for a given key from the TraceState if it exists.

Inserts the given key-value pair into the TraceState. If a value already exists for the given key, this updates the value and updates the value’s position. If the key or value are invalid per the W3 Spec an Err is returned, else a new TraceState with the updated key/value is returned.

Removes the given key-value pair from the TraceState. If the key is invalid per the W3 Spec an Err is returned. Else, a new TraceState with the removed entry is returned.

If the key is not in TraceState. The original TraceState will be cloned and returned.

Creates a new TraceState header string, delimiting each key and value with a = and each entry with a ,.

Creates a new TraceState header string, with the given key/value delimiter and entry delimiter.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.