Skip to main content

Key

Enum Key 

Source
#[repr(u8)]
pub enum Key {
Show 120 variants A = 4, B = 5, C = 6, D = 7, E = 8, F = 9, G = 10, H = 11, I = 12, J = 13, K = 14, L = 15, M = 16, N = 17, O = 18, P = 19, Q = 20, R = 21, S = 22, T = 23, U = 24, V = 25, W = 26, X = 27, Y = 28, Z = 29, N1 = 30, N2 = 31, N3 = 32, N4 = 33, N5 = 34, N6 = 35, N7 = 36, N8 = 37, N9 = 38, N0 = 39, Enter = 40, Esc = 41, BackSpace = 42, Tab = 43, Space = 44, Minus = 45, Equal = 46, SquareBracketLeft = 47, SquareBracketRight = 48, BackSlash = 49, BackSlash_ = 50, Column = 51, Quote = 52, BackTick = 53, Comma = 54, Period = 55, Slash = 56, Cap = 57, F1 = 58, F2 = 59, F3 = 60, F4 = 61, F5 = 62, F6 = 63, F7 = 64, F8 = 65, F9 = 66, F10 = 67, F11 = 68, F12 = 69, Snapshot = 70, ScrollLock = 71, Pause = 72, Insert = 73, Home = 74, PageUp = 75, Del = 76, End = 77, PageDown = 78, Right = 79, Left = 80, Down = 81, Up = 82, Numlock = 83, NumpadDiv = 84, NumpadMul = 85, NumpadMinus = 86, NumpadPlus = 87, NumpadEnter = 88, Numpad1 = 89, Numpad2 = 90, Numpad3 = 91, Numpad4 = 92, Numpad5 = 93, Numpad6 = 94, Numpad7 = 95, Numpad8 = 96, Numpad9 = 97, Numpad0 = 98, NumpadDec = 99, Apps = 101, F13 = 104, F14 = 105, F15 = 106, F16 = 107, F17 = 108, F18 = 109, F19 = 110, F20 = 111, F21 = 112, F22 = 113, F23 = 114, F24 = 115, Rwin = 140, F24_ = 148, Lctrl = 224, Lshift = 225, Lalt = 226, Lwin = 227, Rctrl = 228, Rshift = 229, Ralt = 230, Rwin_ = 231, Release = 0,
}
Expand description

Represents keyboard keys with their corresponding scan codes.

This enum maps keyboard keys to their usage codes, which are used for sending keyboard input to device. Each variant corresponds to a specific physical key on a standard keyboard layout.

Variants§

§

A = 4

The ‘A’ key

§

B = 5

The ‘B’ key

§

C = 6

The ‘C’ key

§

D = 7

The ‘D’ key

§

E = 8

The ‘E’ key

§

F = 9

The ‘F’ key

§

G = 10

The ‘G’ key

§

H = 11

The ‘H’ key

§

I = 12

The ‘I’ key

§

J = 13

The ‘J’ key

§

K = 14

The ‘K’ key

§

L = 15

The ‘L’ key

§

M = 16

The ‘M’ key

§

N = 17

The ‘N’ key

§

O = 18

The ‘O’ key

§

P = 19

The ‘P’ key

§

Q = 20

The ‘Q’ key

§

R = 21

The ‘R’ key

§

S = 22

The ‘S’ key

§

T = 23

The ‘T’ key

§

U = 24

The ‘U’ key

§

V = 25

The ‘V’ key

§

W = 26

The ‘W’ key

§

X = 27

The ‘X’ key

§

Y = 28

The ‘Y’ key

§

Z = 29

The ‘Z’ key

§

N1 = 30

The ‘1’ number key

§

N2 = 31

The ‘2’ number key

§

N3 = 32

The ‘3’ number key

§

N4 = 33

The ‘4’ number key

§

N5 = 34

The ‘5’ number key

§

N6 = 35

The ‘6’ number key

§

N7 = 36

The ‘7’ number key

§

N8 = 37

The ‘8’ number key

§

N9 = 38

The ‘9’ number key

§

N0 = 39

The ‘0’ number key

§

Enter = 40

The Enter/Return key

§

Esc = 41

The Escape key

§

BackSpace = 42

The Backspace key

§

Tab = 43

The Tab key

§

Space = 44

The Space bar

§

Minus = 45

The minus/hyphen key (-)

§

Equal = 46

The equals key (=)

§

SquareBracketLeft = 47

The left square bracket key ([)

§

SquareBracketRight = 48

The right square bracket key (])

§

BackSlash = 49

The backslash key ()

§

BackSlash_ = 50

Alternative backslash key

§

Column = 51

The semicolon/colon key (;)

§

Quote = 52

The single quote/apostrophe key (’)

§

BackTick = 53

The backtick/grave accent key (`)

§

Comma = 54

The comma key (,)

§

Period = 55

The period/dot key (.)

§

Slash = 56

The forward slash key (/)

§

Cap = 57

The Caps Lock key

§

F1 = 58

Function key F1

§

F2 = 59

Function key F2

§

F3 = 60

Function key F3

§

F4 = 61

Function key F4

§

F5 = 62

Function key F5

§

F6 = 63

Function key F6

§

F7 = 64

Function key F7

§

F8 = 65

Function key F8

§

F9 = 66

Function key F9

§

F10 = 67

Function key F10

§

F11 = 68

Function key F11

§

F12 = 69

Function key F12

§

Snapshot = 70

Print Screen/Snapshot key

§

ScrollLock = 71

Scroll Lock key

§

Pause = 72

Pause/Break key

§

Insert = 73

Insert key

§

Home = 74

Home key

§

PageUp = 75

Page Up key

§

Del = 76

Delete key

§

End = 77

End key

§

PageDown = 78

Page Down key

§

Right = 79

Right arrow key

§

Left = 80

Left arrow key

§

Down = 81

Down arrow key

§

Up = 82

Up arrow key

§

Numlock = 83

Num Lock key

§

NumpadDiv = 84

Numeric keypad division key (/)

§

NumpadMul = 85

Numeric keypad multiplication key (*)

§

NumpadMinus = 86

Numeric keypad minus key (-)

§

NumpadPlus = 87

Numeric keypad plus key (+)

§

NumpadEnter = 88

Numeric keypad Enter key

§

Numpad1 = 89

Numeric keypad 1 key

§

Numpad2 = 90

Numeric keypad 2 key

§

Numpad3 = 91

Numeric keypad 3 key

§

Numpad4 = 92

Numeric keypad 4 key

§

Numpad5 = 93

Numeric keypad 5 key

§

Numpad6 = 94

Numeric keypad 6 key

§

Numpad7 = 95

Numeric keypad 7 key

§

Numpad8 = 96

Numeric keypad 8 key

§

Numpad9 = 97

Numeric keypad 9 key

§

Numpad0 = 98

Numeric keypad 0 key

§

NumpadDec = 99

Numeric keypad decimal point key (.)

§

Apps = 101

Application/Menu key

§

F13 = 104

Function key F13

§

F14 = 105

Function key F14

§

F15 = 106

Function key F15

§

F16 = 107

Function key F16

§

F17 = 108

Function key F17

§

F18 = 109

Function key F18

§

F19 = 110

Function key F19

§

F20 = 111

Function key F20

§

F21 = 112

Function key F21

§

F22 = 113

Function key F22

§

F23 = 114

Function key F23

§

F24 = 115

Function key F24

§

Rwin = 140

Right Windows key

§

F24_ = 148

Alternative F24 key

§

Lctrl = 224

Left Control key

§

Lshift = 225

Left Shift key

§

Lalt = 226

Left Alt key

§

Lwin = 227

Left Windows key

§

Rctrl = 228

Right Control key

§

Rshift = 229

Right Shift key

§

Ralt = 230

Right Alt key

§

Rwin_ = 231

Alternative Right Windows key

§

Release = 0

No key pressed (release state)

Trait Implementations§

Source§

impl Clone for Key

Source§

fn clone(&self) -> Key

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl From<Key> for u8

Source§

fn from(button: Key) -> Self

Converts to this type from the input type.
Source§

impl TryFrom<char> for Key

Source§

type Error = String

The type returned in the event of a conversion error.
Source§

fn try_from(c: char) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for Key

Auto Trait Implementations§

§

impl Freeze for Key

§

impl RefUnwindSafe for Key

§

impl Send for Key

§

impl Sync for Key

§

impl Unpin for Key

§

impl UnsafeUnpin for Key

§

impl UnwindSafe for Key

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.