[][src]Struct opentelemetry_api::resource::Resource

pub struct Resource<'a> {
    pub labels: HashMap<Cow<'a, str>, Cow<'a, str>>,
}

Fields

labels: HashMap<Cow<'a, str>, Cow<'a, str>>

Methods

impl<'a> Resource<'a>[src]

pub fn create<K, V>(labels: HashMap<K, V>) -> Self where
    K: Into<Cow<'a, str>>,
    V: Into<Cow<'a, str>>, 
[src]

Creates a new Resource out of the collection of labels

Panics

If the following hold

  • The length of a key or value is over 256 bytes
  • If a key or value contains none ascii chars

pub fn merge(&mut self, other: Self)[src]

Creates a new Resource that is a combination of labels of two Resources.

For example, from two Resources - one representing the host and one representing a container, resulting Resource will describe both.

Already set labels WILL NOT be overwritten unless they are empty string. Label key name-spacing SHOULD be used to prevent collisions across different resource detection steps.

pub fn labels(&self) -> HashMap<&str, &str>[src]

pub fn get(&self, label: &str) -> Option<&str>[src]

Helper method to get values for given labels

pub fn empty() -> Self[src]

Trait Implementations

impl<'a> Default for Resource<'a>[src]

Auto Trait Implementations

impl<'a> Sync for Resource<'a>

impl<'a> Send for Resource<'a>

impl<'a> Unpin for Resource<'a>

impl<'a> RefUnwindSafe for Resource<'a>

impl<'a> UnwindSafe for Resource<'a>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]