Struct event::EventQueue
[−]
[src]
pub struct EventQueue<R> { /* fields omitted */ }
Methods
impl<R> EventQueue<R>
[src]
fn new() -> Result<EventQueue<R>>
Create a new event queue
fn add<F: FnMut(usize) -> Result<Option<R>> + 'static>(
&mut self,
fd: RawFd,
callback: F
) -> Result<()>
&mut self,
fd: RawFd,
callback: F
) -> Result<()>
Add a file to the event queue, calling a callback when an event occurs
The callback is given a mutable reference to the file and the event data (typically the length of data available for read)
The callback returns Ok(None) if it wishes to continue the event loop, or Ok(Some(R)) to break the event loop and return the value. Err can be used to allow the callback to return an I/O error, and break the event loop
fn remove(
&mut self,
fd: RawFd
) -> Result<Option<Box<FnMut(usize) -> Result<Option<R>>>>>
&mut self,
fd: RawFd
) -> Result<Option<Box<FnMut(usize) -> Result<Option<R>>>>>
Remove a file from the event queue, returning its callback if found
fn trigger(&mut self, fd: RawFd, count: usize) -> Result<Option<R>>
Send an event to a descriptor callback
fn trigger_all(&mut self, count: usize) -> Result<Vec<R>>
Send an event to all descriptor callbacks, useful for cleaning out buffers after init
fn run(&mut self) -> Result<R>
Process the event queue until a callback returns Some(R)