Skip to main content

EventHandler

Trait EventHandler 

Source
pub trait EventHandler {
    type Reaction;

    // Required methods
    fn interests(&self) -> Option<Interest>;
    fn handle(&mut self, event: &Event) -> Vec<Self::Reaction>;
}
Expand description

A resource which can be managed by the reactor.

Required Associated Types§

Source

type Reaction

The type of reactions which this resource may generate upon receiving I/O from the reactor via EventHandler::handle. These events are passed to the reactor crate::reactor::ReactionHandler.

Required Methods§

Source

fn interests(&self) -> Option<Interest>

Method informing the reactor which types of events this resource is subscribed for.

Source

fn handle(&mut self, event: &Event) -> Vec<Self::Reaction>

Method called by the reactor when an I/O readiness event is received for this resource.

Implementors§