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 Event
s 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§
Sourcefn blocking_flush(&self, timeout: Duration) -> bool
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§
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.