Struct opentelemetry::sdk::resource::Resource
source · pub struct Resource { /* private fields */ }
Expand description
Describes an entity about which identifying information and metadata is exposed.
Items are sorted by their key, and are only overwritten if the value is an empty string.
Implementations§
source§impl Resource
impl Resource
sourcepub fn new<T: IntoIterator<Item = KeyValue>>(kvs: T) -> Self
pub fn new<T: IntoIterator<Item = KeyValue>>(kvs: T) -> Self
Create a new Resource
from key value pairs.
Values are de-duplicated by key, and the first key-value pair with a non-empty string value will be retained
sourcepub fn from_detectors(
timeout: Duration,
detectors: Vec<Box<dyn ResourceDetector>>
) -> Self
pub fn from_detectors( timeout: Duration, detectors: Vec<Box<dyn ResourceDetector>> ) -> Self
Create a new Resource
from resource detectors.
timeout will be applied to each detector.
sourcepub fn merge<T: Deref<Target = Self>>(&self, other: T) -> Self
pub fn merge<T: Deref<Target = Self>>(&self, other: T) -> Self
Create a new Resource
by combining two resources.
Keys from the other
resource have priority over keys from this resource, even if the
updated value is empty.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Resource
impl<'de> Deserialize<'de> for Resource
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<'a> IntoIterator for &'a Resource
impl<'a> IntoIterator for &'a Resource
source§impl IntoIterator for Resource
impl IntoIterator for Resource
source§impl PartialEq for Resource
impl PartialEq for Resource
impl StructuralPartialEq for Resource
Auto Trait Implementations§
impl RefUnwindSafe for Resource
impl Send for Resource
impl Sync for Resource
impl Unpin for Resource
impl UnwindSafe for Resource
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