Skip to main content

HidKeyCode

Enum HidKeyCode 

Source
#[repr(u8)]
pub enum HidKeyCode {
Show 222 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, Kc1 = 30, Kc2 = 31, Kc3 = 32, Kc4 = 33, Kc5 = 34, Kc6 = 35, Kc7 = 36, Kc8 = 37, Kc9 = 38, Kc0 = 39, Enter = 40, Escape = 41, Backspace = 42, Tab = 43, Space = 44, Minus = 45, Equal = 46, LeftBracket = 47, RightBracket = 48, Backslash = 49, NonusHash = 50, Semicolon = 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, PrintScreen = 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, 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, NonusBackslash = 100, Application = 101, KbPower = 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, KbMute = 127, KbVolumeUp = 128, KbVolumeDown = 129, LockingCapsLock = 130, LockingNumLock = 131, LockingScrollLock = 132, KpComma = 133, KpEqualAs400 = 134, International1 = 135, International2 = 136, International3 = 137, International4 = 138, International5 = 139, International6 = 140, International7 = 141, International8 = 142, International9 = 143, Language1 = 144, Language2 = 145, Language3 = 146, Language4 = 147, Language5 = 148, Language6 = 149, Language7 = 150, Language8 = 151, Language9 = 152, AlternateErase = 153, SystemRequest = 154, Cancel = 155, Clear = 156, Prior = 157, Return = 158, Separator = 159, Out = 160, Oper = 161, ClearAgain = 162, Crsel = 163, Exsel = 164, SystemPower = 165, SystemSleep = 166, SystemWake = 167, AudioMute = 168, AudioVolUp = 169, AudioVolDown = 170, MediaNextTrack = 171, MediaPrevTrack = 172, MediaStop = 173, MediaPlayPause = 174, MediaSelect = 175, MediaEject = 176, Mail = 177, Calculator = 178, MyComputer = 179, WwwSearch = 180, WwwHome = 181, WwwBack = 182, WwwForward = 183, WwwStop = 184, WwwRefresh = 185, WwwFavorites = 186, MediaFastForward = 187, MediaRewind = 188, BrightnessUp = 189, BrightnessDown = 190, ControlPanel = 191, Assistant = 192, MissionControl = 193, Launchpad = 194, MouseUp = 205, MouseDown = 206, MouseLeft = 207, MouseRight = 208, MouseBtn1 = 209, MouseBtn2 = 210, MouseBtn3 = 211, MouseBtn4 = 212, MouseBtn5 = 213, MouseBtn6 = 214, MouseBtn7 = 215, MouseBtn8 = 216, MouseWheelUp = 217, MouseWheelDown = 218, MouseWheelLeft = 219, MouseWheelRight = 220, MouseAccel0 = 221, MouseAccel1 = 222, MouseAccel2 = 223, LCtrl = 224, LShift = 225, LAlt = 226, LGui = 227, RCtrl = 228, RShift = 229, RAlt = 230, RGui = 231,
}

Variants§

§

No = 0

Reserved, no-key.

§

ErrorRollover = 1

Keyboard roll over error, too many keys are pressed simultaneously, not a physical key. NKRO: n-key rollover.

§

PostFail = 2

Keyboard post fail error, not a physical key.

§

ErrorUndefined = 3

An undefined error, not a physical key.

§

A = 4

a and A

§

B = 5

b and B

§

C = 6

c and C

§

D = 7

d and D

§

E = 8

e and E

§

F = 9

f and F

§

G = 10

g and G

§

H = 11

h and H

§

I = 12

i and I

§

J = 13

j and J

§

K = 14

k and K

§

L = 15

l and L

§

M = 16

m and M

§

N = 17

n and N

§

O = 18

o and O

§

P = 19

p and P

§

Q = 20

q and Q

§

R = 21

r and R

§

S = 22

s and S

§

T = 23

t and T

§

U = 24

u and U

§

V = 25

v and V

§

W = 26

w and W

§

X = 27

x and X

§

Y = 28

y and Y

§

Z = 29

z and Z

§

Kc1 = 30

1 and !

§

Kc2 = 31

2 and @

§

Kc3 = 32

3 and #

§

Kc4 = 33

4 and $

§

Kc5 = 34

5 and %

§

Kc6 = 35

6 and ^

§

Kc7 = 36

7 and &

§

Kc8 = 37

8 and *

§

Kc9 = 38

9 and (

§

Kc0 = 39

0 and )

§

Enter = 40

Enter

§

Escape = 41

Esc

§

Backspace = 42

Backspace

§

Tab = 43

Tab

§

Space = 44

Space

§

Minus = 45

- and _

§

Equal = 46

= and +

§

LeftBracket = 47

[ and {

§

RightBracket = 48

] and }

§

Backslash = 49

\ and |

§

NonusHash = 50

Non-US # and ~

§

Semicolon = 51

; and :

§

Quote = 52

' and "

§

Grave = 53

~ and ```

§

Comma = 54

, and <

§

Dot = 55

. and >

§

Slash = 56

/ and ?

§

CapsLock = 57

CapsLock

§

F1 = 58

F1

§

F2 = 59

F2

§

F3 = 60

F3

§

F4 = 61

F4

§

F5 = 62

F5

§

F6 = 63

F6

§

F7 = 64

F7

§

F8 = 65

F8

§

F9 = 66

F9

§

F10 = 67

F10

§

F11 = 68

F11

§

F12 = 69

F12

§

PrintScreen = 70

Print Screen

§

ScrollLock = 71

Scroll Lock

§

Pause = 72

Pause

§

Insert = 73

Insert

§

Home = 74

Home

§

PageUp = 75

Page Up

§

Delete = 76

Delete

§

End = 77

End

§

PageDown = 78

Page Down

§

Right = 79

Right arrow

§

Left = 80

Left arrow

§

Down = 81

Down arrow

§

Up = 82

Up arrow

§

NumLock = 83

Nums Lock

§

KpSlash = 84

/ on keypad

§

KpAsterisk = 85

* on keypad

§

KpMinus = 86

- on keypad

§

KpPlus = 87

+ on keypad

§

KpEnter = 88

Enter on keypad

§

Kp1 = 89

1 on keypad

§

Kp2 = 90

2 on keypad

§

Kp3 = 91

3 on keypad

§

Kp4 = 92

4 on keypad

§

Kp5 = 93

5 on keypad

§

Kp6 = 94

6 on keypad

§

Kp7 = 95

7 on keypad

§

Kp8 = 96

8 on keypad

§

Kp9 = 97

9 on keypad

§

Kp0 = 98

0 on keypad

§

KpDot = 99

. on keypad

§

NonusBackslash = 100

Non-US \ or |

§

Application = 101

Application

§

KbPower = 102

Power

§

KpEqual = 103

= on keypad

§

F13 = 104

F13

§

F14 = 105

F14

§

F15 = 106

F15

§

F16 = 107

F16

§

F17 = 108

F17

§

F18 = 109

F18

§

F19 = 110

F19

§

F20 = 111

F20

§

F21 = 112

F21

§

F22 = 113

F22

§

F23 = 114

F23

§

F24 = 115

F24

§

Execute = 116

§

Help = 117

§

Menu = 118

§

Select = 119

§

Stop = 120

§

Again = 121

§

Undo = 122

§

Cut = 123

§

Copy = 124

§

Paste = 125

§

Find = 126

§

KbMute = 127

Mute

§

KbVolumeUp = 128

Volume Up

§

KbVolumeDown = 129

Volume Down

§

LockingCapsLock = 130

Locking Caps Lock

§

LockingNumLock = 131

Locking Num Lock

§

LockingScrollLock = 132

Locking scroll lock

§

KpComma = 133

§

KpEqualAs400 = 134

§

International1 = 135

§

International2 = 136

§

International3 = 137

§

International4 = 138

§

International5 = 139

§

International6 = 140

§

International7 = 141

§

International8 = 142

§

International9 = 143

§

Language1 = 144

§

Language2 = 145

§

Language3 = 146

§

Language4 = 147

§

Language5 = 148

§

Language6 = 149

§

Language7 = 150

§

Language8 = 151

§

Language9 = 152

§

AlternateErase = 153

§

SystemRequest = 154

§

Cancel = 155

§

Clear = 156

§

Prior = 157

§

Return = 158

§

Separator = 159

§

Out = 160

§

Oper = 161

§

ClearAgain = 162

§

Crsel = 163

§

Exsel = 164

§

SystemPower = 165

§

SystemSleep = 166

§

SystemWake = 167

§

AudioMute = 168

§

AudioVolUp = 169

§

AudioVolDown = 170

§

MediaNextTrack = 171

§

MediaPrevTrack = 172

§

MediaStop = 173

§

MediaPlayPause = 174

§

MediaSelect = 175

§

MediaEject = 176

§

Mail = 177

§

Calculator = 178

§

MyComputer = 179

§

WwwSearch = 180

§

WwwHome = 181

§

WwwBack = 182

§

WwwForward = 183

§

WwwStop = 184

§

WwwRefresh = 185

§

WwwFavorites = 186

§

MediaFastForward = 187

§

MediaRewind = 188

§

BrightnessUp = 189

Brightness Up

§

BrightnessDown = 190

Brightness Down

§

ControlPanel = 191

§

Assistant = 192

§

MissionControl = 193

§

Launchpad = 194

§

MouseUp = 205

Mouse Up

§

MouseDown = 206

Mouse Down

§

MouseLeft = 207

Mouse Left

§

MouseRight = 208

Mouse Right

§

MouseBtn1 = 209

Mouse Button 1(Left)

§

MouseBtn2 = 210

Mouse Button 2(Right)

§

MouseBtn3 = 211

Mouse Button 3(Middle)

§

MouseBtn4 = 212

Mouse Button 4(Back)

§

MouseBtn5 = 213

Mouse Button 5(Forward)

§

MouseBtn6 = 214

§

MouseBtn7 = 215

§

MouseBtn8 = 216

§

MouseWheelUp = 217

§

MouseWheelDown = 218

§

MouseWheelLeft = 219

§

MouseWheelRight = 220

§

MouseAccel0 = 221

§

MouseAccel1 = 222

§

MouseAccel2 = 223

§

LCtrl = 224

Left Control

§

LShift = 225

Left Shift

§

LAlt = 226

Left Alt

§

LGui = 227

Left GUI

§

RCtrl = 228

Right Control

§

RShift = 229

Right Shift

§

RAlt = 230

Right Alt

§

RGui = 231

Right GUI

Implementations§

Source§

impl HidKeyCode

Source

pub const fn from_repr(discriminant: u8) -> Option<HidKeyCode>

Try to create Self from the raw representation

Source§

impl HidKeyCode

Source

pub fn is_simple_key(self) -> bool

Returns true if the keycode is a simple keycode defined in HID spec

Source

pub fn is_modifier(self) -> bool

Returns true if the keycode is a modifier keycode

Source

pub fn is_mouse_key(self) -> bool

Returns true if the keycode is a mouse keycode

Source

pub fn to_hid_modifiers(self) -> ModifierCombination

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

Source

pub fn is_caps_word_continue_key(self) -> bool

Does current keycode continues Caps Word?

Source

pub fn is_caps_word_shifted_key(self) -> bool

Does current keycode is to be shifted by Caps Word?

Source

pub fn process_as_consumer(&self) -> Option<ConsumerKey>

Some hid keycodes are processed as consumer keys, for compatibility

Source

pub fn process_as_system_control(&self) -> Option<SystemControlKey>

Some hid keycodes are processed as system control keys, for compatibility

Trait Implementations§

Source§

impl Clone for HidKeyCode

Source§

fn clone(&self) -> HidKeyCode

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 HidKeyCode

Source§

impl Debug for HidKeyCode

Source§

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

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

impl<'de> Deserialize<'de> for HidKeyCode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for HidKeyCode

Source§

impl From<u8> for HidKeyCode

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl MaxSize for HidKeyCode

Source§

const POSTCARD_MAX_SIZE: usize

The maximum possible size that the serialization of this type can have, in bytes.
Source§

impl Ord for HidKeyCode

Source§

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

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · 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 HidKeyCode

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for HidKeyCode

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 Serialize for HidKeyCode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for HidKeyCode

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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, 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.