Skip to main content

Event

Trait Event 

Source
pub trait Event:
    Any
    + Debug
    + Send
    + Sync
    + 'static {
    // Required method
    fn event_type_id(&self) -> EventTypeId;
}
Expand description

Marker trait every concrete event type implements. Required supertraits give the bus enough to box, store, and downcast: Any for the cast, Send + Sync + 'static for cross-thread shipping, Debug for diagnostic logs.

Required Methods§

Source

fn event_type_id(&self) -> EventTypeId

The type-id under which this event is registered. Implementors typically delegate to a static to avoid re-allocating the metadata on every call. The macro register_event! generates this for you.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§