#[non_exhaustive]
pub enum Key {
Show 112 variants
A,
B,
C,
D,
E,
F,
G,
H,
I,
J,
K,
L,
M,
N,
O,
P,
Q,
R,
S,
T,
U,
V,
W,
X,
Y,
Z,
Num0,
Num1,
Num2,
Num3,
Num4,
Num5,
Num6,
Num7,
Num8,
Num9,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12,
F13,
F14,
F15,
F16,
F17,
F18,
F19,
F20,
F21,
F22,
F23,
F24,
NumLock,
NumPad1,
NumPad2,
NumPad3,
NumPad4,
NumPad5,
NumPad6,
NumPad7,
NumPad8,
NumPad9,
NumPad0,
NumPadPlus,
NumPadMinus,
NumPadMultiply,
NumPadDivide,
NumPadEnter,
LeftCtrl,
LeftShift,
LeftAlt,
RightCtrl,
RightShift,
RightAlt,
Up,
Down,
Left,
Right,
Backquote,
Backslash,
Backspace,
CapsLock,
Comma,
Delete,
End,
Enter,
Equals,
Escape,
Home,
Insert,
LeftBracket,
Minus,
PageDown,
PageUp,
Pause,
Period,
PrintScreen,
Quote,
RightBracket,
ScrollLock,
Semicolon,
Slash,
Space,
Tab,
}
Expand description
A physical key on a keyboard.
This type represents keys based on their physical position, independent from the user’s
active keyboard layout. The variants are named based on how the keys are labelled on a
US QWERTY keyboard. For example, Key::A
is the key to the right of the Caps Lock,
even if the user is on an AZERTY keyboard.
This is used as the default representation as it allows non-QWERTY keyboard layouts to be supported with minimal effort on the developer’s part. However, you should consider providing configurable input bindings too, for maximum accessibility.
If you need to determine what a key represents in the current keyboard layout (e.g.
to display button prompts, or for a config screen), you can use the get_key_label
function.
Serde
Serialization and deserialization of this type (via Serde)
can be enabled via the serde_support
feature.