Skip to main content

Key

Enum Key 

Source
#[repr(u8)]
pub enum Key {
Show 156 variants None = 0, Overflow = 1, PostFail = 2, Undefined = 3, 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, Num1 = 30, Num2 = 31, Num3 = 32, Num4 = 33, Num5 = 34, Num6 = 35, Num7 = 36, Num8 = 37, Num9 = 38, Num0 = 39, Enter = 40, Esc = 41, BackSpace = 42, Tab = 43, Space = 44, Minus = 45, Equal = 46, LeftBrace = 47, RightBrace = 48, BackSlash = 49, HashTilde = 50, Semicolon = 51, Apostrophe = 52, Grave = 53, Comma = 54, Dot = 55, Slash = 56, CapsLock = 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, SysRq = 70, ScrollLock = 71, Pause = 72, Insert = 73, Home = 74, PageUp = 75, Delete = 76, End = 77, PageDown = 78, Right = 79, Left = 80, Down = 81, Up = 82, NumLock = 83, KeyPadSlash = 84, KeyPadAsterisk = 85, KeyPadMinus = 86, KeyPadPlus = 87, KeyPadEnter = 88, KeyPad1 = 89, KeyPad2 = 90, KeyPad3 = 91, KeyPad4 = 92, KeyPad5 = 93, KeyPad6 = 94, KeyPad7 = 95, KeyPad8 = 96, KeyPad9 = 97, KeyPad0 = 98, KeyPadDot = 99, NonUsBackSlash = 100, Compose = 101, Power = 102, KeyPadEqual = 103, F13 = 104, F14 = 105, F15 = 106, F16 = 107, F17 = 108, F18 = 109, F19 = 110, F20 = 111, F21 = 112, F22 = 113, F23 = 114, F24 = 115, Open = 116, Help = 117, Props = 118, Front = 119, Stop = 120, Again = 121, Undo = 122, Cut = 123, Copy = 124, Paste = 125, Find = 126, Mute = 127, VolumeUp = 128, VolumeDown = 129, LockingCapsLock = 130, LockingNumLock = 131, LockingScrollLock = 132, KeyPadComma = 133, KeyPadEqualSign = 134, Ro = 135, KatakanaHiragana = 136, Yen = 137, Henkan = 138, Munenkan = 139, KeyPadJpComma = 140, Hangeul = 144, Hanja = 145, Katakana = 146, Hiragana = 147, ZankakuHankaku = 148, KeyPadLeftParen = 182, KeyPadRightParen = 183, LeftCtrl = 224, LeftShift = 225, LeftAlt = 226, LeftMeta = 227, RightCtrl = 228, RightShift = 229, RightAlt = 230, RightMeta = 231,
}
Expand description

Key code

Variants§

§

None = 0

No key

§

Overflow = 1

Keyboard Error Roll Over - used for all slots if too many keys are pressed (“Phantom key”)

§

PostFail = 2

Keyboard POST Fail

§

Undefined = 3

Keyboard Error Undefined

§

A = 4

Keyboard a and A

§

B = 5

Keyboard b and B

§

C = 6

Keyboard c and C

§

D = 7

Keyboard d and D

§

E = 8

Keyboard e and E

§

F = 9

Keyboard f and F

§

G = 10

Keyboard g and G

§

H = 11

Keyboard h and H

§

I = 12

Keyboard i and I

§

J = 13

Keyboard j and J

§

K = 14

Keyboard k and K

§

L = 15

Keyboard l and L

§

M = 16

Keyboard m and M

§

N = 17

Keyboard n and N

§

O = 18

Keyboard o and O

§

P = 19

Keyboard p and P

§

Q = 20

Keyboard q and Q

§

R = 21

Keyboard r and R

§

S = 22

Keyboard s and S

§

T = 23

Keyboard t and T

§

U = 24

Keyboard u and U

§

V = 25

Keyboard v and V

§

W = 26

Keyboard w and W

§

X = 27

Keyboard x and X

§

Y = 28

Keyboard y and Y

§

Z = 29

Keyboard z and Z

§

Num1 = 30

Keyboard 1 and !

§

Num2 = 31

Keyboard 2 and @

§

Num3 = 32

Keyboard 3 and #

§

Num4 = 33

Keyboard 4 and $

§

Num5 = 34

Keyboard 5 and %

§

Num6 = 35

Keyboard 6 and ^

§

Num7 = 36

Keyboard 7 and &

§

Num8 = 37

Keyboard 8 and *

§

Num9 = 38

Keyboard 9 and (

§

Num0 = 39

Keyboard 0 and )

§

Enter = 40

Keyboard Return (ENTER)

§

Esc = 41

Keyboard ESCAPE

§

BackSpace = 42

Keyboard DELETE (Backspace)

§

Tab = 43

Keyboard Tab

§

Space = 44

Keyboard Spacebar

§

Minus = 45

Keyboard - and _

§

Equal = 46

Keyboard = and +

§

LeftBrace = 47

Keyboard [ and {

§

RightBrace = 48

Keyboard ] and }

§

BackSlash = 49

Keyboard \ and |

§

HashTilde = 50

Keyboard Non-US # and ~

§

Semicolon = 51

Keyboard ; and :

§

Apostrophe = 52

Keyboard ’ and “

§

Grave = 53

Keyboard ` and ~

§

Comma = 54

Keyboard , and <

§

Dot = 55

Keyboard . and >

§

Slash = 56

Keyboard / and ?

§

CapsLock = 57

Keyboard Caps Lock

§

F1 = 58

Keyboard F1

§

F2 = 59

Keyboard F2

§

F3 = 60

Keyboard F3

§

F4 = 61

Keyboard F4

§

F5 = 62

Keyboard F5

§

F6 = 63

Keyboard F6

§

F7 = 64

Keyboard F7

§

F8 = 65

Keyboard F8

§

F9 = 66

Keyboard F9

§

F10 = 67

Keyboard F10

§

F11 = 68

Keyboard F11

§

F12 = 69

Keyboard F12

§

SysRq = 70

Keyboard Print Screen

§

ScrollLock = 71

Keyboard Scroll Lock

§

Pause = 72

Keyboard Pause

§

Insert = 73

Keyboard Insert

§

Home = 74

Keyboard Home

§

PageUp = 75

Keyboard Page Up

§

Delete = 76

Keyboard Delete Forward

§

End = 77

Keyboard End

§

PageDown = 78

Keyboard Page Down

§

Right = 79

Keyboard Right Arrow

§

Left = 80

Keyboard Left Arrow

§

Down = 81

Keyboard Down Arrow

§

Up = 82

Keyboard Up Arrow

§

NumLock = 83

Keyboard Num Lock and Clear

§

KeyPadSlash = 84

Keypad /

§

KeyPadAsterisk = 85

Keypad *

§

KeyPadMinus = 86

Keypad -

§

KeyPadPlus = 87

Keypad +

§

KeyPadEnter = 88

Keypad ENTER

§

KeyPad1 = 89

Keypad 1 and End

§

KeyPad2 = 90

Keypad 2 and Down Arrow

§

KeyPad3 = 91

Keypad 3 and PageDn

§

KeyPad4 = 92

Keypad 4 and Left Arrow

§

KeyPad5 = 93

Keypad 5

§

KeyPad6 = 94

Keypad 6 and Right Arrow

§

KeyPad7 = 95

Keypad 7 and Home

§

KeyPad8 = 96

Keypad 8 and Up Arrow

§

KeyPad9 = 97

Keypad 9 and Page Up

§

KeyPad0 = 98

Keypad 0 and Insert

§

KeyPadDot = 99

Keypad . and Delete

§

NonUsBackSlash = 100

Keyboard Non-US \ and |

§

Compose = 101

Keyboard Application

§

Power = 102

Keyboard Power

§

KeyPadEqual = 103

Keypad =

§

F13 = 104

Keyboard F13

§

F14 = 105

Keyboard F14

§

F15 = 106

Keyboard F15

§

F16 = 107

Keyboard F16

§

F17 = 108

Keyboard F17

§

F18 = 109

Keyboard F18

§

F19 = 110

Keyboard F19

§

F20 = 111

Keyboard F20

§

F21 = 112

Keyboard F21

§

F22 = 113

Keyboard F22

§

F23 = 114

Keyboard F23

§

F24 = 115

Keyboard F24

§

Open = 116

Keyboard Execute

§

Help = 117

Keyboard Help

§

Props = 118

Keyboard Menu

§

Front = 119

Keyboard Select

§

Stop = 120

Keyboard Stop

§

Again = 121

Keyboard Again

§

Undo = 122

Keyboard Undo

§

Cut = 123

Keyboard Cut

§

Copy = 124

Keyboard Copy

§

Paste = 125

Keyboard Paste

§

Find = 126

Keyboard Find

§

Mute = 127

Keyboard Mute

§

VolumeUp = 128

Keyboard Volume Up

§

VolumeDown = 129

Keyboard Volume Down

§

LockingCapsLock = 130

Keyboard Locking Caps Lock

§

LockingNumLock = 131

Keyboard Locking Num Lock

§

LockingScrollLock = 132

Keyboard Locking Scroll Lock

§

KeyPadComma = 133

Keypad Comma

§

KeyPadEqualSign = 134

Keypad Equal Sign

§

Ro = 135

Keyboard International1

§

KatakanaHiragana = 136

Keyboard International2

§

Yen = 137

Keyboard International3

§

Henkan = 138

Keyboard International4

§

Munenkan = 139

Keyboard International5

§

KeyPadJpComma = 140

Keyboard International6

§

Hangeul = 144

Keyboard LANG1

§

Hanja = 145

Keyboard LANG2

§

Katakana = 146

Keyboard LANG3

§

Hiragana = 147

Keyboard LANG4

§

ZankakuHankaku = 148

Keyboard LANG5

§

KeyPadLeftParen = 182

Keypad (

§

KeyPadRightParen = 183

Keypad )

§

LeftCtrl = 224

Keyboard Left Control

§

LeftShift = 225

Keyboard Left Shift

§

LeftAlt = 226

Keyboard Left Alt

§

LeftMeta = 227

Keyboard Left GUI

§

RightCtrl = 228

Keyboard Right Control

§

RightShift = 229

Keyboard Right Shift

§

RightAlt = 230

Keyboard Right Alt

§

RightMeta = 231

Keyboard Right GUI

Implementations§

Source§

impl Key

Source

pub const VARIANTS: &'static [Key]

List of all enum variants

Source§

impl Key

Source

pub fn safe_from(raw: u8) -> Option<Self>

Converts from raw value safely

Trait Implementations§

Source§

impl AsMut<[u8]> for Key

Source§

fn as_mut(&mut self) -> &mut [u8]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<[u8]> for Key

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<str> for Key

Available on crate feature display only.
Source§

fn as_ref(&self) -> &str

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Clone for Key

Source§

fn clone(&self) -> Key

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Key

Source§

impl Debug for Key

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Key

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Key

Available on crate feature display only.
Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Key

Source§

impl From<Key> for u8

Source§

fn from(key: Key) -> Self

Converts to this type from the input type.
Source§

impl From<Key> for Modifiers

Source§

fn from(key: Key) -> Self

Converts to this type from the input type.
Source§

impl From<Modifiers> for Key

Source§

fn from(mods: Modifiers) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for Key

Source§

fn from(raw: u8) -> Self

Converts to this type from the input type.
Source§

impl FromStr for Key

Available on crate feature fromstr only.
Source§

type Err = Unknown

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl PartialEq for Key

Source§

fn eq(&self, other: &Key) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.