Enum pc_keyboard::KeyCode

source ·
#[repr(u8)]
pub enum KeyCode {
Show 124 variants Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PrintScreen, SysRq, ScrollLock, PauseBreak, Oem8, Key1, Key2, Key3, Key4, Key5, Key6, Key7, Key8, Key9, Key0, OemMinus, OemPlus, Backspace, Insert, Home, PageUp, NumpadLock, NumpadDivide, NumpadMultiply, NumpadSubtract, Tab, Q, W, E, R, T, Y, U, I, O, P, Oem4, Oem6, Oem5, Oem7, Delete, End, PageDown, Numpad7, Numpad8, Numpad9, NumpadAdd, CapsLock, A, S, D, F, G, H, J, K, L, Oem1, Oem3, Return, Numpad4, Numpad5, Numpad6, LShift, Z, X, C, V, B, N, M, OemComma, OemPeriod, Oem2, RShift, ArrowUp, Numpad1, Numpad2, Numpad3, NumpadEnter, LControl, LWin, LAlt, Spacebar, RAltGr, RWin, Apps, RControl, ArrowLeft, ArrowDown, ArrowRight, Numpad0, NumpadPeriod, Oem9, Oem10, Oem11, Oem12, Oem13, PrevTrack, NextTrack, Mute, Calculator, Play, Stop, VolumeDown, VolumeUp, WWWHome, PowerOnTestOk, TooManyKeys, RControl2, RAlt2,
}
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

Top Left of the Keyboard

§

F1

Function Key F1

§

F2

Function Key F2

§

F3

Function Key F3

§

F4

Function Key F4

§

F5

Function Key F5

§

F6

Function Key F6

§

F7

Function Key F7

§

F8

Function Key F8

§

F9

Function Key F9

§

F10

Function Key F10

§

F11

Function Key F11

§

F12

Function Key F12

§

PrintScreen

The Print Screen Key

§

SysRq

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

§

ScrollLock

The Scroll Lock key

§

PauseBreak

The Pause/Break key

§

Oem8

Symbol key to the left of Key1

§

Key1

Number Line, Digit 1

§

Key2

Number Line, Digit 2

§

Key3

Number Line, Digit 3

§

Key4

Number Line, Digit 4

§

Key5

Number Line, Digit 5

§

Key6

Number Line, Digit 6

§

Key7

Number Line, Digit 7

§

Key8

Number Line, Digit 8

§

Key9

Number Line, Digit 9

§

Key0

Number Line, Digit 0

§

OemMinus

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

§

OemPlus

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

§

Backspace

Backspace

§

Insert

Top Left of the Extended Block

§

Home

Top Middle of the Extended Block

§

PageUp

Top Right of the Extended Block

§

NumpadLock

The Num Lock key

§

NumpadDivide

The Numpad Divide (or Slash) key

§

NumpadMultiply

The Numpad Multiple (or Star) key

§

NumpadSubtract

The Numpad Subtract (or Minus) key

§

Tab

The Tab Key

§

Q

Letters, Top Row #1

§

W

Letters, Top Row #2

§

E

Letters, Top Row #3

§

R

Letters, Top Row #4

§

T

Letters, Top Row #5

§

Y

Letters, Top Row #6

§

U

Letters, Top Row #7

§

I

Letters, Top Row #8

§

O

Letters, Top Row #9

§

P

Letters, Top Row #10

§

Oem4

US ANSI Left-Square-Bracket key

§

Oem6

US ANSI Right-Square-Bracket key

§

Oem5

US ANSI Backslash Key / UK ISO Backslash Key

§

Oem7

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

§

Delete

The Delete key - bottom Left of the Extended Block

§

End

The End key - bottom Middle of the Extended Block

§

PageDown

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

§

Numpad7

The Numpad 7/Home key

§

Numpad8

The Numpad 8/Up Arrow key

§

Numpad9

The Numpad 9/Page Up key

§

NumpadAdd

The Numpad Add/Plus key

§

CapsLock

Caps Lock

§

A

Letters, Middle Row #1

§

S

Letters, Middle Row #2

§

D

Letters, Middle Row #3

§

F

Letters, Middle Row #4

§

G

Letters, Middle Row #5

§

H

Letters, Middle Row #6

§

J

Letters, Middle Row #7

§

K

Letters, Middle Row #8

§

L

Letters, Middle Row #9

§

Oem1

The US ANSI Semicolon/Colon key

§

Oem3

The US ANSI Single-Quote/At key

§

Return

The Return Key

§

Numpad4

The Numpad 4/Left Arrow key

§

Numpad5

The Numpad 5 Key

§

Numpad6

The Numpad 6/Right Arrow key

§

LShift

Left Shift

§

Z

Letters, Bottom Row #1

§

X

Letters, Bottom Row #2

§

C

Letters, Bottom Row #3

§

V

Letters, Bottom Row #4

§

B

Letters, Bottom Row #5

§

N

Letters, Bottom Row #6

§

M

Letters, Bottom Row #7

§

OemComma

US ANSI ,< key

§

OemPeriod

US ANSI .> Key

§

Oem2

US ANSI /? Key

§

RShift

Right Shift

§

ArrowUp

The up-arrow in the inverted-T

§

Numpad1

Numpad 1/End Key

§

Numpad2

Numpad 2/Arrow Down Key

§

Numpad3

Numpad 3/Page Down Key

§

NumpadEnter

Numpad Enter

§

LControl

The left-hand Control key

§

LWin

The left-hand ‘Windows’ key

§

LAlt

The left-hand Alt key

§

Spacebar

The Space Bar

§

RAltGr

The right-hand AltGr key

§

RWin

The right-hand Win key

§

Apps

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

§

RControl

The right-hand Control key

§

ArrowLeft

The left-arrow in the inverted-T

§

ArrowDown

The down-arrow in the inverted-T

§

ArrowRight

The right-arrow in the inverted-T

§

Numpad0

The Numpad 0/Insert Key

§

NumpadPeriod

The Numppad Period/Delete Key

§

Oem9

Extra JIS key (0x7B)

§

Oem10

Extra JIS key (0x79)

§

Oem11

Extra JIS key (0x70)

§

Oem12

Extra JIS symbol key (0x73)

§

Oem13

Extra JIS symbol key (0x7D)

§

PrevTrack

Multi-media keys - Previous Track

§

NextTrack

Multi-media keys - Next Track

§

Mute

Multi-media keys - Volume Mute Toggle

§

Calculator

Multi-media keys - Open Calculator

§

Play

Multi-media keys - Play

§

Stop

Multi-media keys - Stop

§

VolumeDown

Multi-media keys - Increase Volume

§

VolumeUp

Multi-media keys - Decrease Volume

§

WWWHome

Multi-media keys - Open Browser

§

PowerOnTestOk

Sent when the keyboard boots

§

TooManyKeys

Sent by the keyboard when too many keys are pressed

§

RControl2

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

§

RAlt2

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 · 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 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) -> Selfwhere Self: Sized,

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

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

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

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

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

impl PartialEq<KeyCode> 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 · source§

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

This method 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

This method 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

This method 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

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§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.