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<'de> Deserialize<'de> for KeyEvent
impl<'de> Deserialize<'de> for KeyEvent
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialOrd for KeyEvent
impl PartialOrd for KeyEvent
impl 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