[−][src]Struct opentelemetry::api::correlation::CorrelationContext
A set of name/value pairs describing user-defined properties across systems.
Implementations
impl CorrelationContext
[src]
pub fn new() -> Self
[src]
Creates an empty CorrelationContext
.
pub fn get<T: Into<Key>>(&self, key: T) -> Option<&Value>
[src]
Returns a reference to the value associated with a given name
Examples
use opentelemetry::api::{CorrelationContext, Value}; let mut cc = CorrelationContext::new(); let _ = cc.insert("my-name", "my-value"); assert_eq!(cc.get("my-name"), Some(&Value::String("my-value".to_string())))
pub fn insert<K, V>(&mut self, key: K, value: V) -> Option<Value> where
K: Into<Key>,
V: Into<Value>,
[src]
K: Into<Key>,
V: Into<Value>,
Inserts a name-value pair into the correlation context.
If the name was not present, None
is returned. If the name was present,
the value is updated, and the old value is returned.
Examples
use opentelemetry::api::{CorrelationContext, Value}; let mut cc = CorrelationContext::new(); let _ = cc.insert("my-name", "my-value"); assert_eq!(cc.get("my-name"), Some(&Value::String("my-value".to_string())))
pub fn remove<K: Into<Key>>(&mut self, key: K) -> Option<Value>
[src]
Removes a name from the correlation context, returning the value corresponding to the name if the pair was previously in the map.
pub fn len(&self) -> usize
[src]
Returns the number of attributes for this correlation context
pub fn is_empty(&self) -> bool
[src]
Returns true
if the correlation context contains no items.
pub fn iter(&self) -> Iter
[src]
Gets an iterator over the correlation context items, sorted by name.
Trait Implementations
impl Debug for CorrelationContext
[src]
impl Default for CorrelationContext
[src]
fn default() -> CorrelationContext
[src]
impl FromIterator<(Key, Value)> for CorrelationContext
[src]
impl FromIterator<KeyValue> for CorrelationContext
[src]
fn from_iter<I: IntoIterator<Item = KeyValue>>(iter: I) -> Self
[src]
impl<'a> IntoIterator for &'a CorrelationContext
[src]
Auto Trait Implementations
impl RefUnwindSafe for CorrelationContext
impl Send for CorrelationContext
impl Sync for CorrelationContext
impl Unpin for CorrelationContext
impl UnwindSafe for CorrelationContext
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> FutureExt for T
[src]
fn with_context(self, otel_cx: OpenTelemetryContext) -> WithContext<Self>
[src]
fn with_current_context(self) -> WithContext<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,