pub struct ResourceBuilder { /* private fields */ }
Expand description
Builder for Resource
Implementations§
Source§impl ResourceBuilder
impl ResourceBuilder
Sourcepub fn with_detector(self, detector: Box<dyn ResourceDetector>) -> Self
pub fn with_detector(self, detector: Box<dyn ResourceDetector>) -> Self
Add a single ResourceDetector to your resource.
Sourcepub fn with_detectors(self, detectors: &[Box<dyn ResourceDetector>]) -> Self
pub fn with_detectors(self, detectors: &[Box<dyn ResourceDetector>]) -> Self
Add multiple ResourceDetectors to your resource.
Sourcepub fn with_attribute(self, kv: KeyValue) -> Self
pub fn with_attribute(self, kv: KeyValue) -> Self
Add a KeyValue to the resource.
Sourcepub fn with_attributes<T: IntoIterator<Item = KeyValue>>(self, kvs: T) -> Self
pub fn with_attributes<T: IntoIterator<Item = KeyValue>>(self, kvs: T) -> Self
Add multiple KeyValues to the resource.
Sourcepub fn with_service_name(self, name: impl Into<Value>) -> Self
pub fn with_service_name(self, name: impl Into<Value>) -> Self
Add service.name
resource attribute.
Sourcepub fn with_schema_url<KV, S>(self, attributes: KV, schema_url: S) -> Self
pub fn with_schema_url<KV, S>(self, attributes: KV, schema_url: S) -> Self
This will merge the provided schema_url
with the current state of the Resource being built. It
will use the following rules to determine which schema_url
should be used.
§Schema url
Schema url is determined by the following rules, in order:
- If the current builder resource doesn’t have a
schema_url
, the providedschema_url
will be used. - If the current builder resource has a
schema_url
, and the providedschema_url
is different from the builder resource,schema_url
will be empty. - If the provided
schema_url
is the same as the current builder resource, it will be used.
Sourcepub fn build(self) -> Resource
pub fn build(self) -> Resource
Create a Resource with the options provided to the ResourceBuilder.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResourceBuilder
impl RefUnwindSafe for ResourceBuilder
impl Send for ResourceBuilder
impl Sync for ResourceBuilder
impl Unpin for ResourceBuilder
impl UnwindSafe for ResourceBuilder
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