Trait devices::virtio::input::event_source::EventSource
source · pub trait EventSource: AsRawDescriptor {
// Required methods
fn receive_events(&mut self) -> Result<usize>;
fn available_events_count(&self) -> usize;
fn pop_available_event(&mut self) -> Option<virtio_input_event>;
fn send_event(&mut self, vio_evt: &virtio_input_event) -> Result<()>;
// Provided methods
fn init(&mut self) -> Result<()> { ... }
fn finalize(&mut self) -> Result<()> { ... }
}
Expand description
Encapsulates a socket or device node into an abstract event source, providing a common interface. It supports read and write operations to provide and accept events just like an event device node would, except that it handles virtio_input_event instead of input_event structures. It’s necessary to call receive_events() before events are available for read.
Required Methods§
sourcefn receive_events(&mut self) -> Result<usize>
fn receive_events(&mut self) -> Result<usize>
Receive events from the source, filters them and stores them in a queue for future consumption by reading from this object. Returns the number of new non filtered events received. This function may block waiting for events to be available.
sourcefn available_events_count(&self) -> usize
fn available_events_count(&self) -> usize
Returns the number of received events that have not been filtered or consumed yet.
sourcefn pop_available_event(&mut self) -> Option<virtio_input_event>
fn pop_available_event(&mut self) -> Option<virtio_input_event>
Returns the next available event
sourcefn send_event(&mut self, vio_evt: &virtio_input_event) -> Result<()>
fn send_event(&mut self, vio_evt: &virtio_input_event) -> Result<()>
Sends a status update event to the source