pub struct KeyEvent(/* private fields */);Expand description
A key press/release/repeat event.
Implementations§
Source§impl KeyEvent
impl KeyEvent
pub fn new(key: Key, state: KeyState) -> Self
Sourcepub fn state(&self) -> KeyState
pub fn state(&self) -> KeyState
Returns the state of the key.
This will be KeyState::RELEASED if the key has been released, KeyState::PRESSED if
it has just been pressed, and KeyState::REPEAT if the key has been held down after being
pressed.
Methods from Deref<Target = InputEvent>§
Sourcepub fn time(&self) -> SystemTime
pub fn time(&self) -> SystemTime
Returns the timestamp stored in the event.
The clock source used to generate event timestamps can be changed by calling
Evdev::set_clockid.
Sourcepub fn kind(&self) -> EventKind
pub fn kind(&self) -> EventKind
Returns the EventKind this InputEvent encodes.
EventKind is a matchable, type-safe enum which is intended to be the primary way most
applications examine input events.
EventKind is #[non_exhaustive], so matching on it requires a wildcard arm that will
catch any events that don’t have a specific EventKind variant.
Future versions of evdevil might add new variants to catch those events.
Sourcepub fn event_type(&self) -> EventType
pub fn event_type(&self) -> EventType
Returns the EventType of this event.
Sourcepub fn raw_code(&self) -> u16
pub fn raw_code(&self) -> u16
Returns the raw event code field.
The code of an InputEvent generally describes what entity the event is describing.
Depending on the type of event, it can describe a key, axis, sound, LED, or other entity.
Sourcepub fn raw_value(&self) -> i32
pub fn raw_value(&self) -> i32
Returns the raw event value field.
The value of an InputEvent describes the new state of the key, axis, LED, or other
entity.