Struct calloop::EventLoop [−][src]
pub struct EventLoop<Data> { /* fields omitted */ }
An event loop
This loop can host several event sources, that can be dynamically added or removed.
Methods
impl<Data> EventLoop<Data>
[src]
impl<Data> EventLoop<Data>
pub fn new() -> Result<EventLoop<Data>>
[src]
pub fn new() -> Result<EventLoop<Data>>
Create a new event loop
It is backed by an mio
provided machinnery, and will fail if the mio
initialization fails.
pub fn handle(&self) -> LoopHandle<Data>
[src]
pub fn handle(&self) -> LoopHandle<Data>
Retrieve a loop handle
pub fn dispatch(
&mut self,
timeout: Option<Duration>,
data: &mut Data
) -> Result<()>
[src]
pub fn dispatch(
&mut self,
timeout: Option<Duration>,
data: &mut Data
) -> Result<()>
Dispatch pending events to their callbacks
Some source have events available, their callbacks will be immediatly called.
Otherwise this will wait until an event is receive or the provided timeout
is reached. If timeout
is None
, it will wait without a duration limit.
Once pending events have been processed or the timeout is reached, all pending idle callbacks will be fired before this method returns.