pub enum KeyCode {
Show 82 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,
Digit0,
Digit1,
Digit2,
Digit3,
Digit4,
Digit5,
Digit6,
Digit7,
Digit8,
Digit9,
F1,
F2,
F3,
F4,
F5,
F6,
F7,
F8,
F9,
F10,
F11,
F12,
ArrowUp,
ArrowDown,
ArrowLeft,
ArrowRight,
Home,
End,
PageUp,
PageDown,
Backspace,
Delete,
Enter,
Tab,
Space,
Escape,
ShiftLeft,
ShiftRight,
ControlLeft,
ControlRight,
AltLeft,
AltRight,
MetaLeft,
MetaRight,
Minus,
Equal,
BracketLeft,
BracketRight,
Backslash,
Semicolon,
Quote,
Comma,
Period,
Slash,
Backquote,
Unknown,
}Expand description
Physical key codes for keyboard input.
These represent physical keys on the keyboard, independent of the character they produce (which depends on keyboard layout).
Variants§
A
The A key.
B
The B key.
C
The C key.
D
The D key.
E
The E key.
F
The F key.
G
The G key.
H
The H key.
I
The I key.
J
The J key.
K
The K key.
L
The L key.
M
The M key.
N
The N key.
O
The O key.
P
The P key.
Q
The Q key.
R
The R key.
S
The S key.
T
The T key.
U
The U key.
V
The V key.
W
The W key.
X
The X key.
Y
The Y key.
Z
The Z key.
Digit0
The 0 key on the main number row.
Digit1
The 1 key on the main number row.
Digit2
The 2 key on the main number row.
Digit3
The 3 key on the main number row.
Digit4
The 4 key on the main number row.
Digit5
The 5 key on the main number row.
Digit6
The 6 key on the main number row.
Digit7
The 7 key on the main number row.
Digit8
The 8 key on the main number row.
Digit9
The 9 key on the main number row.
F1
The F1 function key.
F2
The F2 function key.
F3
The F3 function key.
F4
The F4 function key.
F5
The F5 function key.
F6
The F6 function key.
F7
The F7 function key.
F8
The F8 function key.
F9
The F9 function key.
F10
The F10 function key.
F11
The F11 function key.
F12
The F12 function key.
ArrowUp
The up arrow key.
ArrowDown
The down arrow key.
ArrowLeft
The left arrow key.
ArrowRight
The right arrow key.
Home
The Home key.
End
The End key.
PageUp
The Page Up key.
PageDown
The Page Down key.
Backspace
The Backspace key, which deletes backward.
Delete
The Delete key, which deletes forward.
Enter
The main Enter or Return key.
Tab
The Tab key.
Space
The space bar.
Escape
The Escape key.
ShiftLeft
The left Shift key.
ShiftRight
The right Shift key.
ControlLeft
The left Control key.
ControlRight
The right Control key.
AltLeft
The left Alt key, called Option on macOS.
AltRight
The right Alt key, called Option on macOS.
MetaLeft
The left Meta key: Command on macOS, the Windows key elsewhere.
MetaRight
The right Meta key: Command on macOS, the Windows key elsewhere.
Minus
The minus and underscore key on US layouts.
Equal
The equals and plus key on US layouts.
BracketLeft
The left square bracket key on US layouts.
BracketRight
The right square bracket key on US layouts.
Backslash
The backslash key on US layouts.
Semicolon
The semicolon and colon key on US layouts.
Quote
The apostrophe and quotation mark key on US layouts.
Comma
The comma key on US layouts.
Period
The period key on US layouts.
Slash
The forward slash key on US layouts.
Backquote
The grave accent and tilde key on US layouts, left of the 1 key.
Unknown
Key not recognized or not mapped.
Implementations§
Source§impl KeyCode
impl KeyCode
Sourcepub fn from_dom_code(code: &str) -> Self
pub fn from_dom_code(code: &str) -> Self
The key a W3C KeyboardEvent.code value names, such as "KeyA",
"ArrowUp" or "ShiftLeft"; "NumpadEnter" is KeyCode::Enter. A
code with no counterpart here is KeyCode::Unknown.
Trait Implementations§
impl Copy for KeyCode
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more