Skip to main content

EventHandler

Trait EventHandler 

Source
pub trait EventHandler {
    // Required method
    fn handle(&mut self, ctx: &mut HandlerCtx<'_>) -> Propagation;
}
Expand description

A typed event handler attached to a node.

Required Methods§

Source

fn handle(&mut self, ctx: &mut HandlerCtx<'_>) -> Propagation

Handle ctx.event and return propagation control.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F> EventHandler for F
where F: FnMut(&mut HandlerCtx<'_>) -> Propagation,

Blanket impl so plain closures can be used as handlers.