pub enum KeyCode {
Show 127 variants
KeyA,
KeyB,
KeyC,
KeyD,
KeyE,
KeyF,
KeyG,
KeyH,
KeyI,
KeyJ,
KeyK,
KeyL,
KeyM,
KeyN,
KeyO,
KeyP,
KeyQ,
KeyR,
KeyS,
KeyT,
KeyU,
KeyV,
KeyW,
KeyX,
KeyY,
KeyZ,
Digit0,
Digit1,
Digit2,
Digit3,
Digit4,
Digit5,
Digit6,
Digit7,
Digit8,
Digit9,
Backquote,
Minus,
Equal,
BracketLeft,
BracketRight,
Backslash,
Semicolon,
Quote,
Comma,
Period,
Slash,
IntlBackslash,
IntlRo,
IntlYen,
Escape,
Tab,
CapsLock,
Backspace,
Enter,
Space,
ShiftLeft,
ShiftRight,
ControlLeft,
ControlRight,
AltLeft,
AltRight,
MetaLeft,
MetaRight,
ContextMenu,
Insert,
Delete,
Home,
End,
PageUp,
PageDown,
ArrowUp,
ArrowDown,
ArrowLeft,
ArrowRight,
PrintScreen,
ScrollLock,
Pause,
NumLock,
Numpad0,
Numpad1,
Numpad2,
Numpad3,
Numpad4,
Numpad5,
Numpad6,
Numpad7,
Numpad8,
Numpad9,
NumpadDivide,
NumpadMultiply,
NumpadSubtract,
NumpadAdd,
NumpadEnter,
NumpadDecimal,
NumpadEqual,
NumpadComma,
KanaMode,
Lang1,
Lang2,
Convert,
NonConvert,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12,
F13,
F14,
F15,
F16,
F17,
F18,
F19,
F20,
F21,
F22,
F23,
F24,
Unidentified,
}Expand description
A key by where it is on the keyboard, whatever the layout says
it types: the W3C UI Events code names (KeyA is the key
right of Caps Lock, also on an AZERTY keyboard).
Variants§
KeyA
KeyB
KeyC
KeyD
KeyE
KeyF
KeyG
KeyH
KeyI
KeyJ
KeyK
KeyL
KeyM
KeyN
KeyO
KeyP
KeyQ
KeyR
KeyS
KeyT
KeyU
KeyV
KeyW
KeyX
KeyY
KeyZ
Digit0
Digit1
Digit2
Digit3
Digit4
Digit5
Digit6
Digit7
Digit8
Digit9
Backquote
Minus
Equal
BracketLeft
BracketRight
Backslash
Semicolon
Quote
Comma
Period
Slash
IntlBackslash
IntlRo
IntlYen
Escape
Tab
CapsLock
Backspace
Enter
Space
ShiftLeft
ShiftRight
ControlLeft
ControlRight
AltLeft
AltRight
MetaLeft
MetaRight
ContextMenu
Insert
Delete
Home
End
PageUp
PageDown
ArrowUp
ArrowDown
ArrowLeft
ArrowRight
PrintScreen
ScrollLock
Pause
NumLock
Numpad0
Numpad1
Numpad2
Numpad3
Numpad4
Numpad5
Numpad6
Numpad7
Numpad8
Numpad9
NumpadDivide
NumpadMultiply
NumpadSubtract
NumpadAdd
NumpadEnter
NumpadDecimal
NumpadEqual
NumpadComma
KanaMode
Lang1
Lang2
Convert
NonConvert
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
F11
F12
F13
F14
F15
F16
F17
F18
F19
F20
F21
F22
F23
F24
Unidentified
A key without a name here: see the event’s native code.
Implementations§
Source§impl KeyCode
impl KeyCode
Sourcepub fn from_evdev(code: u32) -> KeyCode
pub fn from_evdev(code: u32) -> KeyCode
The key a Linux evdev code stands for (GTK’s and Qt’s hardware key codes, on X11 and Wayland, are 8 more).
Sourcepub fn from_keysym(keysym: u32) -> Option<KeyCode>
pub fn from_keysym(keysym: u32) -> Option<KeyCode>
The key an XKB keysym names, for the keys that type no character
(modifiers, Caps Lock, Escape, arrows, function keys); None for
the others. A keymap’s options move these (ctrl:swapcaps,
caps:escape) above the evdev code, as macOS and Windows remap
below theirs, so they’re read from the keysym the key types. Meta
is left out: it’s Shift+Alt’s keysym on most layouts.
Sourcepub fn from_windows_scancode(code: u32) -> KeyCode
pub fn from_windows_scancode(code: u32) -> KeyCode
The key a Windows scan code stands for: set 1, 0xE0 in the high
byte for extended keys (as WM_KEYDOWN flags them).
Sourcepub fn from_us_char(c: char) -> KeyCode
pub fn from_us_char(c: char) -> KeyCode
The key that types this character on a US keyboard, unshifted: what tests type.