Trait calloop::EventSource [−][src]
pub trait EventSource: Evented { type Event; fn interest(&self) -> Ready; fn pollopts(&self) -> PollOpt; fn make_dispatcher<Data: 'static, F: FnMut(Self::Event, &mut Data) + 'static>(
&self,
callback: F
) -> Rc<RefCell<EventDispatcher<Data>>>; }
Trait representing a source that can be inserted into an EventLoop
This is the interface between the source and the loop, you need to implement it to use your custom event sources.
Associated Types
type Event
The type of events generated by your sources
Required Methods
fn interest(&self) -> Ready
The interest value that will be given to mio
when registering your source
fn pollopts(&self) -> PollOpt
The pollopt value that will be given to mio
when registering your source
fn make_dispatcher<Data: 'static, F: FnMut(Self::Event, &mut Data) + 'static>(
&self,
callback: F
) -> Rc<RefCell<EventDispatcher<Data>>>
&self,
callback: F
) -> Rc<RefCell<EventDispatcher<Data>>>
Wrap an user callback into a dispatcher, that will convert an mio
readiness
into an event