Skip to main content

EventHandler

Trait EventHandler 

Source
pub trait EventHandler {
    // Required method
    fn handle_event(&self, event: Event) -> Result<(), ReplayEvent>;
}
Expand description

A trait implemented for objects handling events from EventsProvider.

An async variation also exists for implementations of EventsProvider that support async event handling. The async event handler should satisfy the generic bounds: F: core::future::Future<Output = Result<(), ReplayEvent>>, H: Fn(Event) -> F.

Required Methods§

Source

fn handle_event(&self, event: Event) -> Result<(), ReplayEvent>

Handles the given Event.

See EventsProvider for details that must be considered when implementing this method.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: EventHandler> EventHandler for Arc<T>

Implementors§

Source§

impl<F> EventHandler for F
where F: Fn(Event) -> Result<(), ReplayEvent>,