Trait mrogalski_looper::Handler
[−]
[src]
pub trait Handler<EVENT: Send>: Sized { fn start(&mut self, sender: Sender<EVENT>); fn handle(&mut self, event: EVENT) -> bool; fn end(self) { ... } }
Handles events sent to the event loop.
Required Methods
fn start(&mut self, sender: Sender<EVENT>)
Called immediately after starting the event loop.
The Sender
argument can be used to send new events. It can be cloned and passed to other threads in this method.
When the last sender is dropped and there are no events pending, the event loop terminates.
fn handle(&mut self, event: EVENT) -> bool
Called for every event sent to the event loop.
Provided Methods
fn end(self)
Called after event loop terminates.
The default implementation does nothing and can be overriden.