Trait GenericEvent

Source
pub trait GenericEvent: AsRef<InputEvent> + AsRef<input_event> {
    // Required methods
    fn event_kind(&self) -> EventKind;
    fn time(&self) -> &EventTime;
    fn code(&self) -> u16;
    fn value(&self) -> i32;
    fn from_ref(event: &InputEvent) -> Result<&Self, RangeError>;
    fn from_mut(event: &mut InputEvent) -> Result<&mut Self, RangeError>;

    // Provided methods
    fn with_event(event: InputEvent) -> Result<Self, RangeError>
       where Self: Clone { ... }
    unsafe fn with_event_unchecked(event: InputEvent) -> Self
       where Self: Clone { ... }
}
Expand description

A generic linux input event.

Required Methods§

Source

fn event_kind(&self) -> EventKind

The event kind.

Source

fn time(&self) -> &EventTime

The timestamp associated with the event.

Source

fn code(&self) -> u16

The type code value of the event.

Source

fn value(&self) -> i32

The value associated with the event.

Source

fn from_ref(event: &InputEvent) -> Result<&Self, RangeError>

Interprets a generic event reference into a concrete event type.

Source

fn from_mut(event: &mut InputEvent) -> Result<&mut Self, RangeError>

Interprets a mutable generic event reference into a concrete event type.

Provided Methods§

Source

fn with_event(event: InputEvent) -> Result<Self, RangeError>
where Self: Clone,

Interprets a generic event into a concrete event type.

Source

unsafe fn with_event_unchecked(event: InputEvent) -> Self
where Self: Clone,

Interprets a generic event into a concrete event type.

§Safety

The event must match Self’s event kind and have a valid code.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§