pub struct Resource {
pub attributes: HashMap<String, String>,
}Expand description
Represents a resource (source of telemetry)
Fields§
§attributes: HashMap<String, String>Resource attributes (key-value pairs)
Implementations§
Source§impl Resource
impl Resource
Sourcepub fn with_service_name(name: impl Into<String>) -> Self
pub fn with_service_name(name: impl Into<String>) -> Self
Create a resource with service name
Sourcepub fn with_attribute(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_attribute( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add an attribute to the resource
Sourcepub fn get_attribute(&self, key: &str) -> Option<&String>
pub fn get_attribute(&self, key: &str) -> Option<&String>
Get an attribute value
Sourcepub fn service_name(&self) -> Option<&String>
pub fn service_name(&self) -> Option<&String>
Get the service name
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
impl StructuralPartialEq for Resource
Auto Trait Implementations§
impl Freeze for Resource
impl RefUnwindSafe for Resource
impl Send for Resource
impl Sync for Resource
impl Unpin for Resource
impl UnsafeUnpin 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