pub struct Setup<TEmitter = DefaultEmitter, TFilter = DefaultFilter, TCtxt = DefaultCtxt, TClock = DefaultClock, TRng = DefaultRng> { /* private fields */ }Expand description
A configuration builder for an emit runtime.
Implementations§
Source§impl<TEmitter: Emitter, TFilter: Filter, TCtxt: Ctxt, TClock: Clock, TRng: Rng> Setup<TEmitter, TFilter, TCtxt, TClock, TRng>
impl<TEmitter: Emitter, TFilter: Filter, TCtxt: Ctxt, TClock: Clock, TRng: Rng> Setup<TEmitter, TFilter, TCtxt, TClock, TRng>
Sourcepub fn emit_to<UEmitter: Emitter>(
self,
emitter: UEmitter,
) -> Setup<UEmitter, TFilter, TCtxt, TClock, TRng>
pub fn emit_to<UEmitter: Emitter>( self, emitter: UEmitter, ) -> Setup<UEmitter, TFilter, TCtxt, TClock, TRng>
Set the Emitter that will receive diagnostic events.
Sourcepub fn and_emit_to<UEmitter: Emitter>(
self,
emitter: UEmitter,
) -> Setup<And<TEmitter, UEmitter>, TFilter, TCtxt, TClock, TRng>
pub fn and_emit_to<UEmitter: Emitter>( self, emitter: UEmitter, ) -> Setup<And<TEmitter, UEmitter>, TFilter, TCtxt, TClock, TRng>
Add an Emitter that will also receive diagnostic events.
Sourcepub fn map_emitter<UEmitter: Emitter>(
self,
map: impl FnOnce(TEmitter) -> UEmitter,
) -> Setup<UEmitter, TFilter, TCtxt, TClock, TRng>
pub fn map_emitter<UEmitter: Emitter>( self, map: impl FnOnce(TEmitter) -> UEmitter, ) -> Setup<UEmitter, TFilter, TCtxt, TClock, TRng>
Map the current Emitter into a new value.
Sourcepub fn emit_when<UFilter: Filter>(
self,
filter: UFilter,
) -> Setup<TEmitter, UFilter, TCtxt, TClock, TRng>
pub fn emit_when<UFilter: Filter>( self, filter: UFilter, ) -> Setup<TEmitter, UFilter, TCtxt, TClock, TRng>
Set the Filter that will be applied before diagnostic events are emitted.
Sourcepub fn and_emit_when<UFilter: Filter>(
self,
filter: UFilter,
) -> Setup<TEmitter, And<TFilter, UFilter>, TCtxt, TClock, TRng>
pub fn and_emit_when<UFilter: Filter>( self, filter: UFilter, ) -> Setup<TEmitter, And<TFilter, UFilter>, TCtxt, TClock, TRng>
Add a Filter that will also be applied before diagnostic events are emitted.
Sourcepub fn with_ctxt<UCtxt: Ctxt>(
self,
ctxt: UCtxt,
) -> Setup<TEmitter, TFilter, UCtxt, TClock, TRng>
pub fn with_ctxt<UCtxt: Ctxt>( self, ctxt: UCtxt, ) -> Setup<TEmitter, TFilter, UCtxt, TClock, TRng>
Set the Ctxt that will store ambient properties and attach them to diagnostic events.
Sourcepub fn map_ctxt<UCtxt: Ctxt>(
self,
map: impl FnOnce(TCtxt) -> UCtxt,
) -> Setup<TEmitter, TFilter, UCtxt, TClock, TRng>
pub fn map_ctxt<UCtxt: Ctxt>( self, map: impl FnOnce(TCtxt) -> UCtxt, ) -> Setup<TEmitter, TFilter, UCtxt, TClock, TRng>
Map the current Ctxt into a new value.
Sourcepub fn with_clock<UClock: Clock>(
self,
clock: UClock,
) -> Setup<TEmitter, TFilter, TCtxt, UClock, TRng>
pub fn with_clock<UClock: Clock>( self, clock: UClock, ) -> Setup<TEmitter, TFilter, TCtxt, UClock, TRng>
Set the Clock used to assign timestamps and run timers.
Sourcepub fn with_rng<URng: Rng>(
self,
rng: URng,
) -> Setup<TEmitter, TFilter, TCtxt, TClock, URng>
pub fn with_rng<URng: Rng>( self, rng: URng, ) -> Setup<TEmitter, TFilter, TCtxt, TClock, URng>
Set the Rng used to assign trace and span ids.
Sourcepub fn init_runtime(self) -> Runtime<TEmitter, TFilter, TCtxt, TClock, TRng>
pub fn init_runtime(self) -> Runtime<TEmitter, TFilter, TCtxt, TClock, TRng>
Initialize a standalone runtime.
Source§impl<TEmitter: Emitter + Send + Sync + 'static, TFilter: Filter + Send + Sync + 'static, TCtxt: Ctxt + Send + Sync + 'static, TClock: Clock + Send + Sync + 'static, TRng: Rng + Send + Sync + 'static> Setup<TEmitter, TFilter, TCtxt, TClock, TRng>
impl<TEmitter: Emitter + Send + Sync + 'static, TFilter: Filter + Send + Sync + 'static, TCtxt: Ctxt + Send + Sync + 'static, TClock: Clock + Send + Sync + 'static, TRng: Rng + Send + Sync + 'static> Setup<TEmitter, TFilter, TCtxt, TClock, TRng>
Sourcepub fn init(self) -> Init<'static, TEmitter, TCtxt>
pub fn init(self) -> Init<'static, TEmitter, TCtxt>
Initialize the default runtime used by emit macros.
This method initializes crate::runtime::shared.
§Panics
This method will panic if the slot has already been initialized.
Sourcepub fn try_init(self) -> Option<Init<'static, TEmitter, TCtxt>>
pub fn try_init(self) -> Option<Init<'static, TEmitter, TCtxt>>
Try initialize the default runtime used by emit macros.
This method initializes crate::runtime::shared.
If the slot is already initialized, this method will return None.
Sourcepub fn init_slot<'a>(self, slot: &'a AmbientSlot) -> Init<'a, TEmitter, TCtxt>
pub fn init_slot<'a>(self, slot: &'a AmbientSlot) -> Init<'a, TEmitter, TCtxt>
Initialize a runtime in the given static slot.
§Panics
This method will panic if the slot has already been initialized.
Sourcepub fn try_init_slot<'a>(
self,
slot: &'a AmbientSlot,
) -> Option<Init<'a, TEmitter, TCtxt>>
pub fn try_init_slot<'a>( self, slot: &'a AmbientSlot, ) -> Option<Init<'a, TEmitter, TCtxt>>
Try initialize a runtime in the given static slot.
If the slot is already initialized, this method will return None.
Source§impl<TEmitter: InternalEmitter + Send + Sync + 'static, TFilter: InternalFilter + Send + Sync + 'static, TCtxt: InternalCtxt + Send + Sync + 'static, TClock: InternalClock + Send + Sync + 'static, TRng: InternalRng + Send + Sync + 'static> Setup<TEmitter, TFilter, TCtxt, TClock, TRng>
impl<TEmitter: InternalEmitter + Send + Sync + 'static, TFilter: InternalFilter + Send + Sync + 'static, TCtxt: InternalCtxt + Send + Sync + 'static, TClock: InternalClock + Send + Sync + 'static, TRng: InternalRng + Send + Sync + 'static> Setup<TEmitter, TFilter, TCtxt, TClock, TRng>
Sourcepub fn init_internal(self) -> Init<'static, TEmitter, TCtxt>
pub fn init_internal(self) -> Init<'static, TEmitter, TCtxt>
Initialize the internal runtime used for diagnosing runtimes themselves.
This method initializes crate::runtime::internal.
§Panics
This method will panic if the slot has already been initialized.
Sourcepub fn try_init_internal(self) -> Option<Init<'static, TEmitter, TCtxt>>
pub fn try_init_internal(self) -> Option<Init<'static, TEmitter, TCtxt>>
Initialize the internal runtime used for diagnosing runtimes themselves.
This method initializes crate::runtime::internal.
If the slot is already initialized, this method will return None.