Trait Resource

Source
pub trait Resource:
    AsRawFd
    + WriteAtomic
    + Send {
    type Event;

    // Required methods
    fn interests(&self) -> IoType ;
    fn handle_io(&mut self, io: Io) -> Option<Self::Event>;
}
Expand description

A resource which can be managed by the reactor.

Required Associated Types§

Source

type Event

Events which resource may generate upon receiving I/O from the reactor via Self::handle_io. These events are passed to the reactor crate::Handler.

Required Methods§

Source

fn interests(&self) -> IoType

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

Source

fn handle_io(&mut self, io: Io) -> Option<Self::Event>

Method called by the reactor when an I/O event is received for this resource in a result of poll syscall.

Implementors§