#[non_exhaustive]pub enum KeyCode {
Show 26 variants
Char(char),
Enter,
Backspace,
Tab,
BackTab,
Esc,
Up,
Down,
Left,
Right,
Home,
End,
PageUp,
PageDown,
Delete,
Insert,
Null,
CapsLock,
ScrollLock,
NumLock,
PrintScreen,
Pause,
Menu,
KeypadBegin,
F(u8),
Modifier(ModifierKey),
}Expand description
Key identifier.
Covers printable characters, control keys, arrow keys, function keys, and navigation keys. Unrecognized keys are silently dropped by the crossterm conversion layer.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Char(char)
A printable character (letter, digit, symbol, space, etc.).
Enter
Enter / Return key.
Backspace
Backspace key.
Tab
Tab key (forward tab).
BackTab
Shift+Tab (back tab).
Esc
Escape key.
Up
Up arrow key.
Down
Down arrow key.
Left
Left arrow key.
Right
Right arrow key.
Home
Home key.
End
End key.
PageUp
Page Up key.
PageDown
Page Down key.
Delete
Delete (forward delete) key.
Insert
Insert key.
Null
Null key (Ctrl+Space on some terminals).
CapsLock
Caps Lock key (Kitty keyboard protocol only).
ScrollLock
Scroll Lock key (Kitty keyboard protocol only).
NumLock
Num Lock key (Kitty keyboard protocol only).
PrintScreen
Print Screen key (Kitty keyboard protocol only).
Pause
Pause/Break key (Kitty keyboard protocol only).
Menu
Menu / context menu key.
KeypadBegin
Keypad center key (numpad 5 without NumLock).
F(u8)
Function key F1..F12 (and beyond). The inner u8 is the number.
Modifier(ModifierKey)
A modifier key pressed on its own (a bare Ctrl/Shift/Alt/Super press or release, with no accompanying character).
Only delivered when the Kitty keyboard protocol is active and
RunConfig::report_all_keys(true)
was set, on a supporting terminal (kitty, Ghostty, WezTerm). Most
terminals never emit these, so handlers must treat them as optional.
Since 0.21.0.
Trait Implementations§
impl Eq for KeyCode
impl StructuralPartialEq for KeyCode
Auto Trait Implementations§
impl Freeze for KeyCode
impl RefUnwindSafe for KeyCode
impl Send for KeyCode
impl Sync for KeyCode
impl Unpin for KeyCode
impl UnsafeUnpin for KeyCode
impl UnwindSafe for KeyCode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.