#[non_exhaustive]pub struct EventMetadata {
pub event_name: &'static str,
pub type_id: TypeId,
pub last_dispatch: Instant,
pub dispatch_count: u64,
pub listener_count: usize,
}Expand description
Immutable snapshot of an event type’s metrics.
Returned by crate::EventDispatcher::metrics. Each field reflects
the value at the moment the snapshot was taken; subsequent dispatches
do not mutate it.
Marked #[non_exhaustive] so future minor releases may add metric
fields (e.g. error counts, percentile latencies) without breaking
existing callers. External code must read fields by name, never
construct EventMetadata via struct-literal syntax. The struct is
only produced inside the crate.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.event_name: &'static strFully qualified name of the event type, as reported by
std::any::type_name.
type_id: TypeIdTypeId of the event type. Stable for a given type within a
single process run.
last_dispatch: InstantTimestamp of the most recent dispatch of this event type.
dispatch_count: u64Total number of times this event type has been dispatched since the dispatcher was created.
listener_count: usizeNumber of listeners (sync + async) registered for this event type at the moment the snapshot was taken.
Implementations§
Source§impl EventMetadata
impl EventMetadata
Sourcepub fn time_since_last_dispatch(&self) -> Duration
pub fn time_since_last_dispatch(&self) -> Duration
How long ago the most recent dispatch of this event type was.
Trait Implementations§
Source§impl Clone for EventMetadata
impl Clone for EventMetadata
Source§fn clone(&self) -> EventMetadata
fn clone(&self) -> EventMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more