Enum pc_keyboard::KeyCode

source ·
#[repr(u8)]
pub enum KeyCode {
Show 124 variants Escape = 0, F1 = 1, F2 = 2, F3 = 3, F4 = 4, F5 = 5, F6 = 6, F7 = 7, F8 = 8, F9 = 9, F10 = 10, F11 = 11, F12 = 12, PrintScreen = 13, SysRq = 14, ScrollLock = 15, PauseBreak = 16, Oem8 = 17, Key1 = 18, Key2 = 19, Key3 = 20, Key4 = 21, Key5 = 22, Key6 = 23, Key7 = 24, Key8 = 25, Key9 = 26, Key0 = 27, OemMinus = 28, OemPlus = 29, Backspace = 30, Insert = 31, Home = 32, PageUp = 33, NumpadLock = 34, NumpadDivide = 35, NumpadMultiply = 36, NumpadSubtract = 37, Tab = 38, Q = 39, W = 40, E = 41, R = 42, T = 43, Y = 44, U = 45, I = 46, O = 47, P = 48, Oem4 = 49, Oem6 = 50, Oem5 = 51, Oem7 = 52, Delete = 53, End = 54, PageDown = 55, Numpad7 = 56, Numpad8 = 57, Numpad9 = 58, NumpadAdd = 59, CapsLock = 60, A = 61, S = 62, D = 63, F = 64, G = 65, H = 66, J = 67, K = 68, L = 69, Oem1 = 70, Oem3 = 71, Return = 72, Numpad4 = 73, Numpad5 = 74, Numpad6 = 75, LShift = 76, Z = 77, X = 78, C = 79, V = 80, B = 81, N = 82, M = 83, OemComma = 84, OemPeriod = 85, Oem2 = 86, RShift = 87, ArrowUp = 88, Numpad1 = 89, Numpad2 = 90, Numpad3 = 91, NumpadEnter = 92, LControl = 93, LWin = 94, LAlt = 95, Spacebar = 96, RAltGr = 97, RWin = 98, Apps = 99, RControl = 100, ArrowLeft = 101, ArrowDown = 102, ArrowRight = 103, Numpad0 = 104, NumpadPeriod = 105, Oem9 = 106, Oem10 = 107, Oem11 = 108, Oem12 = 109, Oem13 = 110, PrevTrack = 111, NextTrack = 112, Mute = 113, Calculator = 114, Play = 115, Stop = 116, VolumeDown = 117, VolumeUp = 118, WWWHome = 119, PowerOnTestOk = 120, TooManyKeys = 121, RControl2 = 122, RAlt2 = 123,
}
Expand description

Keycodes that can be generated by a keyboard.

We use this enum to abstract over Scan Code Set 1 and Scan Code Set 2.

See https://kbdlayout.info/kbduk/shiftstates+virtualkeys/base

Variants§

§

Escape = 0

Top Left of the Keyboard

§

F1 = 1

Function Key F1

§

F2 = 2

Function Key F2

§

F3 = 3

Function Key F3

§

F4 = 4

Function Key F4

§

F5 = 5

Function Key F5

§

F6 = 6

Function Key F6

§

F7 = 7

Function Key F7

§

F8 = 8

Function Key F8

§

F9 = 9

Function Key F9

§

F10 = 10

Function Key F10

§

F11 = 11

Function Key F11

§

F12 = 12

Function Key F12

§

PrintScreen = 13

The Print Screen Key

§

SysRq = 14

The Sys Req key (you get this keycode with Alt + PrintScreen)

§

ScrollLock = 15

The Scroll Lock key

§

PauseBreak = 16

The Pause/Break key

§

Oem8 = 17

Symbol key to the left of Key1

§

Key1 = 18

Number Line, Digit 1

§

Key2 = 19

Number Line, Digit 2

§

Key3 = 20

Number Line, Digit 3

§

Key4 = 21

Number Line, Digit 4

§

Key5 = 22

Number Line, Digit 5

§

Key6 = 23

Number Line, Digit 6

§

Key7 = 24

Number Line, Digit 7

§

Key8 = 25

Number Line, Digit 8

§

Key9 = 26

Number Line, Digit 9

§

Key0 = 27

Number Line, Digit 0

§

OemMinus = 28

US Minus/Underscore Key (right of ‘Key0’)

§

OemPlus = 29

US Equals/Plus Key (right of ‘OemMinus’)

§

Backspace = 30

Backspace

§

Insert = 31

Top Left of the Extended Block

§

Home = 32

Top Middle of the Extended Block

§

PageUp = 33

Top Right of the Extended Block

§

NumpadLock = 34

The Num Lock key

§

NumpadDivide = 35

The Numpad Divide (or Slash) key

§

NumpadMultiply = 36

The Numpad Multiple (or Star) key

§

NumpadSubtract = 37

The Numpad Subtract (or Minus) key

§

Tab = 38

The Tab Key

§

Q = 39

Letters, Top Row #1

§

W = 40

Letters, Top Row #2

§

E = 41

Letters, Top Row #3

§

R = 42

Letters, Top Row #4

§

T = 43

Letters, Top Row #5

§

Y = 44

Letters, Top Row #6

§

U = 45

Letters, Top Row #7

§

I = 46

Letters, Top Row #8

§

O = 47

Letters, Top Row #9

§

P = 48

Letters, Top Row #10

§

Oem4 = 49

US ANSI Left-Square-Bracket key

§

Oem6 = 50

US ANSI Right-Square-Bracket key

§

Oem5 = 51

US ANSI Backslash Key / UK ISO Backslash Key

§

Oem7 = 52

The UK/ISO Hash/Tilde key (ISO layout only)

§

Delete = 53

The Delete key - bottom Left of the Extended Block

§

End = 54

The End key - bottom Middle of the Extended Block

§

PageDown = 55

The Page Down key - -bottom Right of the Extended Block

§

Numpad7 = 56

The Numpad 7/Home key

§

Numpad8 = 57

The Numpad 8/Up Arrow key

§

Numpad9 = 58

The Numpad 9/Page Up key

§

NumpadAdd = 59

The Numpad Add/Plus key

§

CapsLock = 60

Caps Lock

§

A = 61

Letters, Middle Row #1

§

S = 62

Letters, Middle Row #2

§

D = 63

Letters, Middle Row #3

§

F = 64

Letters, Middle Row #4

§

G = 65

Letters, Middle Row #5

§

H = 66

Letters, Middle Row #6

§

J = 67

Letters, Middle Row #7

§

K = 68

Letters, Middle Row #8

§

L = 69

Letters, Middle Row #9

§

Oem1 = 70

The US ANSI Semicolon/Colon key

§

Oem3 = 71

The US ANSI Single-Quote/At key

§

Return = 72

The Return Key

§

Numpad4 = 73

The Numpad 4/Left Arrow key

§

Numpad5 = 74

The Numpad 5 Key

§

Numpad6 = 75

The Numpad 6/Right Arrow key

§

LShift = 76

Left Shift

§

Z = 77

Letters, Bottom Row #1

§

X = 78

Letters, Bottom Row #2

§

C = 79

Letters, Bottom Row #3

§

V = 80

Letters, Bottom Row #4

§

B = 81

Letters, Bottom Row #5

§

N = 82

Letters, Bottom Row #6

§

M = 83

Letters, Bottom Row #7

§

OemComma = 84

US ANSI ,< key

§

OemPeriod = 85

US ANSI .> Key

§

Oem2 = 86

US ANSI /? Key

§

RShift = 87

Right Shift

§

ArrowUp = 88

The up-arrow in the inverted-T

§

Numpad1 = 89

Numpad 1/End Key

§

Numpad2 = 90

Numpad 2/Arrow Down Key

§

Numpad3 = 91

Numpad 3/Page Down Key

§

NumpadEnter = 92

Numpad Enter

§

LControl = 93

The left-hand Control key

§

LWin = 94

The left-hand ‘Windows’ key

§

LAlt = 95

The left-hand Alt key

§

Spacebar = 96

The Space Bar

§

RAltGr = 97

The right-hand AltGr key

§

RWin = 98

The right-hand Win key

§

Apps = 99

The ‘Apps’ key (aka ‘Menu’ or ‘Right-Click’)

§

RControl = 100

The right-hand Control key

§

ArrowLeft = 101

The left-arrow in the inverted-T

§

ArrowDown = 102

The down-arrow in the inverted-T

§

ArrowRight = 103

The right-arrow in the inverted-T

§

Numpad0 = 104

The Numpad 0/Insert Key

§

NumpadPeriod = 105

The Numppad Period/Delete Key

§

Oem9 = 106

Extra JIS key (0x7B)

§

Oem10 = 107

Extra JIS key (0x79)

§

Oem11 = 108

Extra JIS key (0x70)

§

Oem12 = 109

Extra JIS symbol key (0x73)

§

Oem13 = 110

Extra JIS symbol key (0x7D)

§

PrevTrack = 111

Multi-media keys - Previous Track

§

NextTrack = 112

Multi-media keys - Next Track

§

Mute = 113

Multi-media keys - Volume Mute Toggle

§

Calculator = 114

Multi-media keys - Open Calculator

§

Play = 115

Multi-media keys - Play

§

Stop = 116

Multi-media keys - Stop

§

VolumeDown = 117

Multi-media keys - Increase Volume

§

VolumeUp = 118

Multi-media keys - Decrease Volume

§

WWWHome = 119

Multi-media keys - Open Browser

§

PowerOnTestOk = 120

Sent when the keyboard boots

§

TooManyKeys = 121

Sent by the keyboard when too many keys are pressed

§

RControl2 = 122

Used as a ‘hidden’ Right Control Key (Pause = RControl2 + Num Lock)

§

RAlt2 = 123

Used as a ‘hidden’ Right Alt Key (Print Screen = RAlt2 + PrntScr)

Trait Implementations§

source§

impl Clone for KeyCode

source§

fn clone(&self) -> KeyCode

Returns a copy of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
source§

impl Debug for KeyCode

source§

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

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

impl Ord for KeyCode

source§

fn cmp(&self, other: &KeyCode) -> Ordering

This method returns an [Ordering] between self and other. Read more
1.21.0§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for KeyCode

source§

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

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

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for KeyCode

source§

fn partial_cmp(&self, other: &KeyCode) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for KeyCode

source§

impl Eq for KeyCode

source§

impl StructuralEq for KeyCode

source§

impl StructuralPartialEq for KeyCode

Auto Trait Implementations§

§

impl RefUnwindSafe for KeyCode

§

impl Send for KeyCode

§

impl Sync for KeyCode

§

impl Unpin for KeyCode

§

impl UnwindSafe for KeyCode

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.