pub struct KeyEvent {
pub code: KeyCode,
pub modifiers: KeyModifiers,
pub kind: KeyEventKind,
pub state: KeyEventState,
}
Expand description
Represents a key event.
Fields§
§code: KeyCode
The key itself.
modifiers: KeyModifiers
Additional key modifiers.
kind: KeyEventKind
Kind of event.
Only set if:
- Unix:
KeyboardEnhancementFlags::REPORT_EVENT_TYPES
has been enabled withPushKeyboardEnhancementFlags
. - Windows: always
state: KeyEventState
Keyboard 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 for KeyEvent
impl PartialEq for KeyEvent
source§impl PartialOrd for KeyEvent
impl PartialOrd 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 moreimpl Copy for KeyEvent
impl Eq for KeyEvent
Auto Trait Implementations§
impl Freeze for KeyEvent
impl RefUnwindSafe for KeyEvent
impl Send for KeyEvent
impl Sync for KeyEvent
impl Unpin for KeyEvent
impl UnwindSafe for KeyEvent
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more