emit_core::emitter

Trait Emitter

Source
pub trait Emitter {
    // Required methods
    fn emit<E: ToEvent>(&self, evt: E);
    fn blocking_flush(&self, timeout: Duration) -> bool;

    // Provided methods
    fn and_to<U>(self, other: U) -> And<Self, U>
       where Self: Sized { ... }
    fn wrap_emitter<W: Wrapping>(self, wrapping: W) -> Wrap<Self, W>
       where Self: Sized { ... }
}
Expand description

An asynchronous destination for diagnostic data.

Once Events are emitted through Emitter::emit, a call to Emitter::blocking_flush must be made to ensure they’re fully processed. This should be done once before the emitter is disposed, but may be more frequent for auditing.

Required Methods§

Source

fn emit<E: ToEvent>(&self, evt: E)

Emit an Event.

Source

fn blocking_flush(&self, timeout: Duration) -> bool

Block for up to timeout, waiting for all diagnostic data emitted up to this point to be fully processed.

This method returns true if the flush completed, and false if it timed out.

If an emitter doesn’t need to flush, this method should immediately return true. If an emitted doesn’t support flushing, this method should immediately return false.

Provided Methods§

Source

fn and_to<U>(self, other: U) -> And<Self, U>
where Self: Sized,

Emit events to both self and other.

Source

fn wrap_emitter<W: Wrapping>(self, wrapping: W) -> Wrap<Self, W>
where Self: Sized,

Wrap the emitter, transforming or filtering Events before it receives them.

Flushing defers to the wrapped emitter.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Emitter for fn(_: Event<'_, &dyn ErasedProps>)

Source§

fn emit<E: ToEvent>(&self, evt: E)

Source§

fn blocking_flush(&self, _: Duration) -> bool

Source§

impl<'a, T: Emitter + ?Sized + 'a> Emitter for Box<T>

Source§

fn emit<E: ToEvent>(&self, evt: E)

Source§

fn blocking_flush(&self, timeout: Duration) -> bool

Source§

impl<'a, T: Emitter + ?Sized + 'a> Emitter for Arc<T>

Source§

fn emit<E: ToEvent>(&self, evt: E)

Source§

fn blocking_flush(&self, timeout: Duration) -> bool

Source§

impl<'a, T: Emitter + ?Sized> Emitter for &'a T

Source§

fn emit<E: ToEvent>(&self, evt: E)

Source§

fn blocking_flush(&self, timeout: Duration) -> bool

Source§

impl<T: Emitter> Emitter for Option<T>

Source§

fn emit<E: ToEvent>(&self, evt: E)

Source§

fn blocking_flush(&self, timeout: Duration) -> bool

Implementors§

Source§

impl Emitter for Empty

Source§

impl<'a> Emitter for dyn ErasedEmitter + 'a

Source§

impl<'a> Emitter for dyn ErasedEmitter + Send + Sync + 'a

Source§

impl<E: Emitter, W: Wrapping> Emitter for Wrap<E, W>

Source§

impl<F: Fn(Event<'_, &dyn ErasedProps>)> Emitter for FromFn<F>

Source§

impl<T: Emitter> Emitter for AssertInternal<T>

Source§

impl<T: Emitter, U: Emitter> Emitter for And<T, U>

Source§

impl<TEmitter: Emitter, TFilter: Filter, TCtxt: Ctxt, TClock: Clock, TRng: Rng> Emitter for Runtime<TEmitter, TFilter, TCtxt, TClock, TRng>