Enum tetra::input::Key[][src]

pub enum Key {
Show 129 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, Ampersand, Asterisk, At, Caret, Colon, Dollar, DoubleQuote, Exclaim, GreaterThan, Hash, LeftParen, LessThan, Percent, Plus, Question, RightParen, Underscore,
}
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.

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
Ampersand
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

Asterisk
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

At
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

Caret
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

Colon
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

Dollar
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

DoubleQuote
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

Exclaim
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

GreaterThan
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

Hash
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

LeftParen
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

LessThan
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

Percent
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

Plus
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

Question
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

RightParen
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

Underscore
👎 Deprecated since 0.6.6:

Key now represents the physical position of a key, independent of the current keyboard layout, so this variant is no longer valid. To represent the key that is labelled with this character, use KeyLabel.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.