pub enum KeyCode {
Show 27 variants
Backspace,
Enter,
Left,
Right,
Up,
Down,
Home,
End,
PageUp,
PageDown,
Tab,
BackTab,
Delete,
Insert,
F(u8),
Char(char),
Null,
Esc,
CapsLock,
ScrollLock,
NumLock,
PrintScreen,
Pause,
Menu,
KeypadBegin,
Media(MediaKeyCode),
Modifier(ModifierKeyCode),
}
Expand description
Represents a key.
Variants
Backspace
Backspace key.
Enter
Enter key.
Left
Left arrow key.
Right
Right arrow key.
Up
Up arrow key.
Down
Down arrow key.
Home
Home key.
End
End key.
PageUp
Page up key.
PageDown
Page down key.
Tab
Tab key.
BackTab
Shift + Tab key.
Delete
Delete key.
Insert
Insert key.
F(u8)
F key.
KeyCode::F(1)
represents F1 key, etc.
Char(char)
A character.
KeyCode::Char('c')
represents c
character, etc.
Null
Null.
Esc
Escape key.
CapsLock
Caps Lock key.
Note: this key can only be read if
KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES
has been enabled with
PushKeyboardEnhancementFlags
.
ScrollLock
Scroll Lock key.
Note: this key can only be read if
KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES
has been enabled with
PushKeyboardEnhancementFlags
.
NumLock
Num Lock key.
Note: this key can only be read if
KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES
has been enabled with
PushKeyboardEnhancementFlags
.
PrintScreen
Print Screen key.
Note: this key can only be read if
KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES
has been enabled with
PushKeyboardEnhancementFlags
.
Pause
Pause key.
Note: this key can only be read if
KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES
has been enabled with
PushKeyboardEnhancementFlags
.
Menu
Menu key.
Note: this key can only be read if
KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES
has been enabled with
PushKeyboardEnhancementFlags
.
KeypadBegin
The “Begin” key (often mapped to the 5 key when Num Lock is turned on).
Note: this key can only be read if
KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES
has been enabled with
PushKeyboardEnhancementFlags
.
Media(MediaKeyCode)
A media key.
Note: these keys can only be read if
KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES
has been enabled with
PushKeyboardEnhancementFlags
.
Modifier(ModifierKeyCode)
A modifier key.
Note: these keys can only be read if both
KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES
and
KeyboardEnhancementFlags::REPORT_ALL_KEYS_AS_ESCAPE_CODES
have been enabled with
PushKeyboardEnhancementFlags
.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for KeyCode
impl<'de> Deserialize<'de> for KeyCode
sourcefn 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
sourceimpl PartialOrd<KeyCode> for KeyCode
impl PartialOrd<KeyCode> for KeyCode
sourcefn partial_cmp(&self, other: &KeyCode) -> Option<Ordering>
fn partial_cmp(&self, other: &KeyCode) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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
impl Copy for KeyCode
impl Eq for KeyCode
impl StructuralEq for KeyCode
impl StructuralPartialEq for KeyCode
Auto Trait Implementations
impl RefUnwindSafe for KeyCode
impl Send for KeyCode
impl Sync for KeyCode
impl Unpin for KeyCode
impl UnwindSafe for KeyCode
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more