Skip to main content

AnyEventListener

Trait AnyEventListener 

Source
pub trait AnyEventListener: Send + Sync {
    // Required methods
    fn handle_event(&self, event: &dyn Event) -> bool;
    fn event_type_id(&self) -> TypeId;
}
Expand description

Type-erased event listener

This allows storing listeners of different event types in the same collection.

Required Methods§

Source

fn handle_event(&self, event: &dyn Event) -> bool

Handles an event if the listener is registered for this event type

§Arguments
  • event - The event to handle
§Returns

true if the listener handled the event, false otherwise

Source

fn event_type_id(&self) -> TypeId

Returns the TypeId of the event type this listener handles

Implementors§