pub struct KeyEvent {
pub code: KeyCode,
pub modifiers: KeyModifiers,
pub kind: KeyEventKind,
pub state: KeyEventState,
}Expand description
Represents a key event.
Fields§
§code: KeyCodeThe key itself.
modifiers: KeyModifiersAdditional key modifiers.
kind: KeyEventKindKind of event.
Only set if:
- Unix:
KeyboardEnhancementFlags::REPORT_EVENT_TYPEShas been enabled withPushKeyboardEnhancementFlags. - Windows: always
state: KeyEventStateKeyboard state.
Only set if KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES has been enabled with
PushKeyboardEnhancementFlags.
Implementations§
source§impl KeyEvent
impl KeyEvent
pub const fn new(code: KeyCode, modifiers: KeyModifiers) -> KeyEvent
pub const fn new_with_kind( code: KeyCode, modifiers: KeyModifiers, kind: KeyEventKind ) -> KeyEvent
pub const fn new_with_kind_and_state( code: KeyCode, modifiers: KeyModifiers, kind: KeyEventKind, state: KeyEventState ) -> KeyEvent
Trait Implementations§
source§impl PartialEq<KeyEvent> for KeyEvent
impl PartialEq<KeyEvent> for KeyEvent
source§impl PartialOrd<KeyEvent> for KeyEvent
impl PartialOrd<KeyEvent> for KeyEvent
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read more