KeyCode

Enum KeyCode 

Source
#[repr(u8)]
pub enum KeyCode {
Show 193 variants No = 0, ErrorRollOver = 1, PostFail = 2, ErrorUndefined = 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, Kb1 = 30, Kb2 = 31, Kb3 = 32, Kb4 = 33, Kb5 = 34, Kb6 = 35, Kb7 = 36, Kb8 = 37, Kb9 = 38, Kb0 = 39, Enter = 40, Escape = 41, BSpace = 42, Tab = 43, Space = 44, Minus = 45, Equal = 46, LBracket = 47, RBracket = 48, Bslash = 49, NonUsHash = 50, SColon = 51, Quote = 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, PScreen = 70, ScrollLock = 71, Pause = 72, Insert = 73, Home = 74, PgUp = 75, Delete = 76, End = 77, PgDown = 78, Right = 79, Left = 80, Down = 81, Up = 82, NumLock = 83, KpSlash = 84, KpAsterisk = 85, KpMinus = 86, KpPlus = 87, KpEnter = 88, Kp1 = 89, Kp2 = 90, Kp3 = 91, Kp4 = 92, Kp5 = 93, Kp6 = 94, Kp7 = 95, Kp8 = 96, Kp9 = 97, Kp0 = 98, KpDot = 99, NonUsBslash = 100, Application = 101, Power = 102, KpEqual = 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, Execute = 116, Help = 117, Menu = 118, Select = 119, Stop = 120, Again = 121, Undo = 122, Cut = 123, Copy = 124, Paste = 125, Find = 126, Mute = 127, VolUp = 128, VolDown = 129, LockingCapsLock = 130, LockingNumLock = 131, LockingScrollLock = 132, KpComma = 133, KpEqualSign = 134, Intl1 = 135, Intl2 = 136, Intl3 = 137, Intl4 = 138, Intl5 = 139, Intl6 = 140, Intl7 = 141, Intl8 = 142, Intl9 = 143, Lang1 = 144, Lang2 = 145, Lang3 = 146, Lang4 = 147, Lang5 = 148, Lang6 = 149, Lang7 = 150, Lang8 = 151, Lang9 = 152, AltErase = 153, SysReq = 154, Cancel = 155, Clear = 156, Prior = 157, Return = 158, Separator = 159, Out = 160, Oper = 161, ClearAgain = 162, CrSel = 163, ExSel = 164, LCtrl = 224, LShift = 225, LAlt = 226, LGui = 227, RCtrl = 228, RShift = 229, RAlt = 230, RGui = 231, MediaPlayPause = 232, MediaStopCD = 233, MediaPreviousSong = 234, MediaNextSong = 235, MediaEjectCD = 236, MediaVolUp = 237, MediaVolDown = 238, MediaMute = 239, MediaWWW = 240, MediaBack = 241, MediaForward = 242, MediaStop = 243, MediaFind = 244, MediaScrollUp = 245, MediaScrollDown = 246, MediaEdit = 247, MediaSleep = 248, MeidaCoffee = 249, MediaRefresh = 250, MediaCalc = 251,
}
Expand description

Define a key code according to the HID specification. Their names correspond to the american QWERTY layout.

Variants§

§

No = 0

The “no” key, a placeholder to express nothing.

§

ErrorRollOver = 1

Error if too much keys are pressed at the same time.

§

PostFail = 2

The POST fail error.

§

ErrorUndefined = 3

An undefined error occured.

§

A = 4

a and A.

§

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

§

Kb1 = 30

1 and !.

§

Kb2 = 31

2 and @.

§

Kb3 = 32

3 and #.

§

Kb4 = 33

4 and $.

§

Kb5 = 34

5 and %.

§

Kb6 = 35

6 and ^.

§

Kb7 = 36

7 and &.

§

Kb8 = 37

8 and *.

§

Kb9 = 38

9 and (.

§

Kb0 = 39

0 and ).

§

Enter = 40

§

Escape = 41

§

BSpace = 42

§

Tab = 43

§

Space = 44

§

Minus = 45

- and _.

§

Equal = 46

= and +.

§

LBracket = 47

[ and {.

§

RBracket = 48

] and }.

§

Bslash = 49

\ and |.

§

NonUsHash = 50

Non-US # and ~ (Typically near the Enter key).

§

SColon = 51

; and :.

§

Quote = 52

' and ".

§

Grave = 53

` and ~.

§

Comma = 54

, and <.

§

Dot = 55

. and >.

§

Slash = 56

/ and ?.

§

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

§

PScreen = 70

§

ScrollLock = 71

§

Pause = 72

§

Insert = 73

§

Home = 74

§

PgUp = 75

§

Delete = 76

§

End = 77

§

PgDown = 78

§

Right = 79

§

Left = 80

§

Down = 81

§

Up = 82

§

NumLock = 83

§

KpSlash = 84

Keypad /

§

KpAsterisk = 85

Keypad *

§

KpMinus = 86

Keypad -.

§

KpPlus = 87

Keypad +.

§

KpEnter = 88

Keypad enter.

§

Kp1 = 89

Keypad 1.

§

Kp2 = 90

§

Kp3 = 91

§

Kp4 = 92

§

Kp5 = 93

§

Kp6 = 94

§

Kp7 = 95

§

Kp8 = 96

§

Kp9 = 97

§

Kp0 = 98

§

KpDot = 99

§

NonUsBslash = 100

Non-US \ and | (Typically near the Left-Shift key)

§

Application = 101

§

Power = 102

not a key, used for errors

§

KpEqual = 103

Keypad =.

§

F13 = 104

§

F14 = 105

§

F15 = 106

§

F16 = 107

§

F17 = 108

§

F18 = 109

§

F19 = 110

§

F20 = 111

§

F21 = 112

§

F22 = 113

§

F23 = 114

§

F24 = 115

§

Execute = 116

§

Help = 117

§

Menu = 118

§

Select = 119

§

Stop = 120

§

Again = 121

§

Undo = 122

§

Cut = 123

§

Copy = 124

§

Paste = 125

§

Find = 126

§

Mute = 127

§

VolUp = 128

§

VolDown = 129

§

LockingCapsLock = 130

Deprecated.

§

LockingNumLock = 131

Deprecated.

§

LockingScrollLock = 132

Deprecated.

§

KpComma = 133

Keypad ,, also used for the brazilian keypad period (.) key.

§

KpEqualSign = 134

Used on AS/400 keyboard

§

Intl1 = 135

§

Intl2 = 136

§

Intl3 = 137

§

Intl4 = 138

§

Intl5 = 139

§

Intl6 = 140

§

Intl7 = 141

§

Intl8 = 142

§

Intl9 = 143

§

Lang1 = 144

§

Lang2 = 145

§

Lang3 = 146

§

Lang4 = 147

§

Lang5 = 148

§

Lang6 = 149

§

Lang7 = 150

§

Lang8 = 151

§

Lang9 = 152

§

AltErase = 153

§

SysReq = 154

§

Cancel = 155

§

Clear = 156

§

Prior = 157

§

Return = 158

§

Separator = 159

§

Out = 160

§

Oper = 161

§

ClearAgain = 162

§

CrSel = 163

§

ExSel = 164

§

LCtrl = 224

Left Control.

§

LShift = 225

Left Shift.

§

LAlt = 226

Left Alt.

§

LGui = 227

Left GUI (the Windows key).

§

RCtrl = 228

Right Control.

§

RShift = 229

Right Shift.

§

RAlt = 230

Right Alt (or Alt Gr).

§

RGui = 231

Right GUI (the Windows key).

§

MediaPlayPause = 232

§

MediaStopCD = 233

§

MediaPreviousSong = 234

§

MediaNextSong = 235

§

MediaEjectCD = 236

§

MediaVolUp = 237

§

MediaVolDown = 238

§

MediaMute = 239

§

MediaWWW = 240

§

MediaBack = 241

§

MediaForward = 242

§

MediaStop = 243

§

MediaFind = 244

§

MediaScrollUp = 245

§

MediaScrollDown = 246

§

MediaEdit = 247

§

MediaSleep = 248

§

MeidaCoffee = 249

§

MediaRefresh = 250

§

MediaCalc = 251

Implementations§

Source§

impl KeyCode

Source

pub fn is_modifier(self) -> bool

Returns true if the key code correspond to a modifier (send separately on USB HID report).

Source

pub fn as_modifier_bit(self) -> u8

Returns the byte with the bit corresponding to the USB HID modifier bitfield setted.

Trait Implementations§

Source§

impl Clone for KeyCode

Source§

fn clone(&self) -> KeyCode

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 Debug for KeyCode

Source§

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

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

impl FromIterator<KeyCode> for KbHidReport

Source§

fn from_iter<T>(iter: T) -> Self
where T: IntoIterator<Item = KeyCode>,

Creates a value from an iterator. 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 · Source§

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

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

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

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

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

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

impl PartialEq for KeyCode

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 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 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

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 StructuralPartialEq for KeyCode

Auto Trait Implementations§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.