Trait calloop::EventSource
source · 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<dyn EventDispatcher<Data>>>;
}
Expand description
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.
Required Associated Types
Required Methods
sourcefn interest(&self) -> Ready
fn interest(&self) -> Ready
The interest value that will be given to mio
when registering your source
sourcefn pollopts(&self) -> PollOpt
fn pollopts(&self) -> PollOpt
The pollopt value that will be given to mio
when registering your source
sourcefn make_dispatcher<Data: 'static, F: FnMut(Self::Event, &mut Data) + 'static>(
&self,
callback: F
) -> Rc<RefCell<dyn EventDispatcher<Data>>>
fn make_dispatcher<Data: 'static, F: FnMut(Self::Event, &mut Data) + 'static>(
&self,
callback: F
) -> Rc<RefCell<dyn EventDispatcher<Data>>>
Wrap an user callback into a dispatcher, that will convert an mio
readiness
into an event