pub trait PollEvents<Event, Error>: Any{
// Required methods
fn as_any(&self) -> &dyn Any;
fn poll(&mut self) -> Result<bool, Error>;
fn read(&mut self) -> Result<Control<Event>, Error>;
}Expand description
Trait for an event-source.
If you need to add your own do the following:
- Implement this trait for a struct that fits.
Required Methods§
fn as_any(&self) -> &dyn Any
Sourcefn poll(&mut self) -> Result<bool, Error>
fn poll(&mut self) -> Result<bool, Error>
Poll for a new event.
Events are not processed immediately when they occur. Instead,
all event sources are polled, the poll state is put into a queue.
Then the queue is emptied one by one and read_execute() is called.
This prevents issues with poll-ordering of multiple sources, and one source cannot just flood the app with events.