pub struct DcontextLayerBuilder<S> { /* private fields */ }Expand description
Builder for configuring a DcontextLayer.
Implementations§
Source§impl<S> DcontextLayerBuilder<S>
impl<S> DcontextLayerBuilder<S>
Sourcepub fn map_field<T: FromFieldValue>(self, field_name: &'static str) -> Self
pub fn map_field<T: FromFieldValue>(self, field_name: &'static str) -> Self
Map a tracing span field to a dcontext key.
When a span containing a field with the given name is entered,
the field value is extracted and set as a dcontext value of type T.
The field name is used as both the tracing field name and the dcontext key.
§Type Requirements
T must implement FromFieldValue for conversion from tracing
field values to the context type.
Sourcepub fn map_field_as<T: FromFieldValue>(
self,
field_name: &'static str,
context_key: &'static str,
) -> Self
pub fn map_field_as<T: FromFieldValue>( self, field_name: &'static str, context_key: &'static str, ) -> Self
Map a tracing span field to a dcontext key with a different key name.
Similar to map_field but allows using a different
name for the dcontext key than the tracing field name.
Sourcepub fn include_span_info(self) -> Self
pub fn include_span_info(self) -> Self
Sourcepub fn build(self) -> DcontextLayer<S>
pub fn build(self) -> DcontextLayer<S>
Build the configured DcontextLayer.
Auto Trait Implementations§
impl<S> Freeze for DcontextLayerBuilder<S>
impl<S> !RefUnwindSafe for DcontextLayerBuilder<S>
impl<S> Send for DcontextLayerBuilder<S>
impl<S> Sync for DcontextLayerBuilder<S>
impl<S> Unpin for DcontextLayerBuilder<S>
impl<S> UnsafeUnpin for DcontextLayerBuilder<S>
impl<S> !UnwindSafe for DcontextLayerBuilder<S>
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