emit::setup

Struct Setup

Source
pub struct Setup<TEmitter = DefaultEmitter, TFilter = DefaultFilter, TCtxt = DefaultCtxt> { /* private fields */ }
Expand description

A configuration builder for an emit runtime.

Implementations§

Source§

impl Setup

Source

pub fn new() -> Self

Create a new builder with the default Emitter, Filter, and Ctxt.

Source§

impl<TEmitter: Emitter, TFilter: Filter, TCtxt: Ctxt> Setup<TEmitter, TFilter, TCtxt>

Source

pub fn emit_to<UEmitter: Emitter>( self, emitter: UEmitter, ) -> Setup<UEmitter, TFilter, TCtxt>

Set the Emitter that will receive diagnostic events.

Source

pub fn and_emit_to<UEmitter: Emitter>( self, emitter: UEmitter, ) -> Setup<And<TEmitter, UEmitter>, TFilter, TCtxt>

Add an Emitter that will also receive diagnostic events.

Source

pub fn map_emitter<UEmitter: Emitter>( self, map: impl FnOnce(TEmitter) -> UEmitter, ) -> Setup<UEmitter, TFilter, TCtxt>

Map the current Emitter into a new value.

Source

pub fn emit_when<UFilter: Filter>( self, filter: UFilter, ) -> Setup<TEmitter, UFilter, TCtxt>

Set the Filter that will be applied before diagnostic events are emitted.

Source

pub fn and_emit_when<UFilter: Filter>( self, filter: UFilter, ) -> Setup<TEmitter, And<TFilter, UFilter>, TCtxt>

Add a Filter that will also be applied before diagnostic events are emitted.

Source

pub fn with_ctxt<UCtxt: Ctxt>( self, ctxt: UCtxt, ) -> Setup<TEmitter, TFilter, UCtxt>

Set the Ctxt that will store ambient properties and attach them to diagnostic events.

Source

pub fn map_ctxt<UCtxt: Ctxt>( self, map: impl FnOnce(TCtxt) -> UCtxt, ) -> Setup<TEmitter, TFilter, UCtxt>

Map the current Ctxt into a new value.

Source§

impl<TEmitter: Emitter + Send + Sync + 'static, TFilter: Filter + Send + Sync + 'static, TCtxt: Ctxt + Send + Sync + 'static> Setup<TEmitter, TFilter, TCtxt>
where TCtxt::Frame: Send + 'static,

Source

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.

Source

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.

Source

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.

Source

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> Setup<TEmitter, TFilter, TCtxt>
where TCtxt::Frame: Send + 'static,

Source

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.

Source

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.

Trait Implementations§

Source§

impl Default for Setup

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<TEmitter, TFilter, TCtxt> Freeze for Setup<TEmitter, TFilter, TCtxt>
where TEmitter: Freeze, TFilter: Freeze, TCtxt: Freeze,

§

impl<TEmitter = Empty, TFilter = Empty, TCtxt = ThreadLocalCtxt> !RefUnwindSafe for Setup<TEmitter, TFilter, TCtxt>

§

impl<TEmitter, TFilter, TCtxt> Send for Setup<TEmitter, TFilter, TCtxt>
where TEmitter: Send, TFilter: Send, TCtxt: Send,

§

impl<TEmitter, TFilter, TCtxt> Sync for Setup<TEmitter, TFilter, TCtxt>
where TEmitter: Sync, TFilter: Sync, TCtxt: Sync,

§

impl<TEmitter, TFilter, TCtxt> Unpin for Setup<TEmitter, TFilter, TCtxt>
where TEmitter: Unpin, TFilter: Unpin, TCtxt: Unpin,

§

impl<TEmitter = Empty, TFilter = Empty, TCtxt = ThreadLocalCtxt> !UnwindSafe for Setup<TEmitter, TFilter, TCtxt>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V