Skip to main content

AnyContextAwareEventListener

Trait AnyContextAwareEventListener 

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

Type-erased context-aware event listener

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

This allows storing listeners of different event types in the same collection. Type-erased context-aware event listener

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

Required Methods§

Source

fn handle_context_event( &self, event: &dyn Event, context: &ApplicationContext, ) -> bool

Handles an event with context access if the listener is registered for this event type

§Arguments
  • event - The event to handle
  • context - Reference to the ApplicationContext
§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§