Enum keyboard_types::Code

source ·
#[non_exhaustive]
pub enum Code {
Show 215 variants Backquote, Backslash, BracketLeft, BracketRight, Comma, Digit0, Digit1, Digit2, Digit3, Digit4, Digit5, Digit6, Digit7, Digit8, Digit9, Equal, IntlBackslash, IntlRo, IntlYen, KeyA, KeyB, KeyC, KeyD, KeyE, KeyF, KeyG, KeyH, KeyI, KeyJ, KeyK, KeyL, KeyM, KeyN, KeyO, KeyP, KeyQ, KeyR, KeyS, KeyT, KeyU, KeyV, KeyW, KeyX, KeyY, KeyZ, Minus, Period, Quote, Semicolon, Slash, AltLeft, AltRight, Backspace, CapsLock, ContextMenu, ControlLeft, ControlRight, Enter, MetaLeft, MetaRight, ShiftLeft, ShiftRight, Space, Tab, Convert, KanaMode, Lang1, Lang2, Lang3, Lang4, Lang5, NonConvert, Delete, End, Help, Home, Insert, PageDown, PageUp, ArrowDown, ArrowLeft, ArrowRight, ArrowUp, NumLock, Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9, NumpadAdd, NumpadBackspace, NumpadClear, NumpadClearEntry, NumpadComma, NumpadDecimal, NumpadDivide, NumpadEnter, NumpadEqual, NumpadHash, NumpadMemoryAdd, NumpadMemoryClear, NumpadMemoryRecall, NumpadMemoryStore, NumpadMemorySubtract, NumpadMultiply, NumpadParenLeft, NumpadParenRight, NumpadStar, NumpadSubtract, Escape, Fn, FnLock, PrintScreen, ScrollLock, Pause, BrowserBack, BrowserFavorites, BrowserForward, BrowserHome, BrowserRefresh, BrowserSearch, BrowserStop, Eject, LaunchApp1, LaunchApp2, LaunchMail, MediaPlayPause, MediaSelect, MediaStop, MediaTrackNext, MediaTrackPrevious, Power, Sleep, AudioVolumeDown, AudioVolumeMute, AudioVolumeUp, WakeUp, Hyper, Super, Turbo, Abort, Resume, Suspend, Again, Copy, Cut, Find, Open, Paste, Props, Select, Undo, Hiragana, Katakana, Unidentified, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, F31, F32, F33, F34, F35, BrightnessDown, BrightnessUp, DisplayToggleIntExt, KeyboardLayoutSelect, LaunchAssistant, LaunchControlPanel, LaunchScreenSaver, MailForward, MailReply, MailSend, MediaFastForward, MediaPause, MediaPlay, MediaRecord, MediaRewind, MicrophoneMuteToggle, PrivacyScreenToggle, SelectTask, ShowAllWindows, ZoomToggle,
}
Expand description

Code is the physical position of a key.

The names are based on the US keyboard. If the key is not present on US keyboards a name from another layout is used.

Specification: https://w3c.github.io/uievents-code/

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Backquote

`~ on a US keyboard. This is the 半角/全角/漢字 (hankaku/zenkaku/kanji) key on Japanese keyboards

§

Backslash

Used for both the US | (on the 101-key layout) and also for the key located between the and Enter keys on row C of the 102-, 104- and 106-key layouts. Labelled #~ on a UK (102) keyboard.

§

BracketLeft

[{ on a US keyboard.

§

BracketRight

]} on a US keyboard.

§

Comma

,< on a US keyboard.

§

Digit0

0) on a US keyboard.

§

Digit1

1! on a US keyboard.

§

Digit2

2@ on a US keyboard.

§

Digit3

3# on a US keyboard.

§

Digit4

4$ on a US keyboard.

§

Digit5

5% on a US keyboard.

§

Digit6

6^ on a US keyboard.

§

Digit7

7& on a US keyboard.

§

Digit8

8* on a US keyboard.

§

Digit9

9( on a US keyboard.

§

Equal

=+ on a US keyboard.

§

IntlBackslash

Located between the left Shift and Z keys. Labelled | on a UK keyboard.

§

IntlRo

Located between the / and right Shift keys. Labelled \ろ (ro) on a Japanese keyboard.

§

IntlYen

Located between the = and Backspace keys. Labelled ¥ (yen) on a Japanese keyboard. / on a Russian keyboard.

§

KeyA

a on a US keyboard. Labelled q on an AZERTY (e.g., French) keyboard.

§

KeyB

b on a US keyboard.

§

KeyC

c on a US keyboard.

§

KeyD

d on a US keyboard.

§

KeyE

e on a US keyboard.

§

KeyF

f on a US keyboard.

§

KeyG

g on a US keyboard.

§

KeyH

h on a US keyboard.

§

KeyI

i on a US keyboard.

§

KeyJ

j on a US keyboard.

§

KeyK

k on a US keyboard.

§

KeyL

l on a US keyboard.

§

KeyM

m on a US keyboard.

§

KeyN

n on a US keyboard.

§

KeyO

o on a US keyboard.

§

KeyP

p on a US keyboard.

§

KeyQ

q on a US keyboard. Labelled a on an AZERTY (e.g., French) keyboard.

§

KeyR

r on a US keyboard.

§

KeyS

s on a US keyboard.

§

KeyT

t on a US keyboard.

§

KeyU

u on a US keyboard.

§

KeyV

v on a US keyboard.

§

KeyW

w on a US keyboard. Labelled z on an AZERTY (e.g., French) keyboard.

§

KeyX

x on a US keyboard.

§

KeyY

y on a US keyboard. Labelled z on a QWERTZ (e.g., German) keyboard.

§

KeyZ

z on a US keyboard. Labelled w on an AZERTY (e.g., French) keyboard, and y on a QWERTZ (e.g., German) keyboard.

§

Minus

-_ on a US keyboard.

§

Period

.> on a US keyboard.

§

Quote

’“ on a US keyboard.

§

Semicolon

;: on a US keyboard.

§

Slash

/? on a US keyboard.

§

AltLeft

Alt, Option or .

§

AltRight

Alt, Option or . This is labelled AltGr key on many keyboard layouts.

§

Backspace

Backspace or . Labelled Delete on Apple keyboards.

§

CapsLock

CapsLock or

§

ContextMenu

The application context menu key, which is typically found between the right Meta key and the right Control key.

§

ControlLeft

Control or

§

ControlRight

Control or

§

Enter

Enter or . Labelled Return on Apple keyboards.

§

MetaLeft

The Windows, , Command or other OS symbol key.

§

MetaRight

The Windows, , Command or other OS symbol key.

§

ShiftLeft

Shift or

§

ShiftRight

Shift or

§

Space

  (space)

§

Tab

Tab or

§

Convert

Japanese: 変換 (henkan)

§

KanaMode

Japanese: カタカナ/ひらがな/ローマ字 (katakana/hiragana/romaji)

§

Lang1

Korean: HangulMode 한/영 (han/yeong)
Japanese (Mac keyboard): かな (kana)

§

Lang2

Korean: Hanja 한자 (hanja)
Japanese (Mac keyboard): 英数 (eisu)

§

Lang3

Japanese (word-processing keyboard): Katakana

§

Lang4

Japanese (word-processing keyboard): Hiragana

§

Lang5

Japanese (word-processing keyboard): Zenkaku/Hankaku

§

NonConvert

Japanese: 無変換 (muhenkan)

§

Delete

. The forward delete key. Note that on Apple keyboards, the key labelled Delete on the main part of the keyboard should be encoded as “Backspace”.

§

End

End or

§

Help

Help. Not present on standard PC keyboards.

§

Home

Home or

§

Insert

Insert or Ins. Not present on Apple keyboards.

§

PageDown

Page Down, PgDn or

§

PageUp

Page Up, PgUp or

§

ArrowDown

§

ArrowLeft

§

ArrowRight

§

ArrowUp

§

NumLock

On the Mac, the “NumLock” code should be used for the numpad Clear key.

§

Numpad0

0 Ins on a keyboard
0 on a phone or remote control

§

Numpad1

1 End on a keyboard
1 or 1 QZ on a phone or remote control

§

Numpad2

2 ↓ on a keyboard
2 ABC on a phone or remote control

§

Numpad3

3 PgDn on a keyboard
3 DEF on a phone or remote control

§

Numpad4

4 ← on a keyboard
4 GHI on a phone or remote control

§

Numpad5

5 on a keyboard
5 JKL on a phone or remote control

§

Numpad6

6 → on a keyboard
6 MNO on a phone or remote control

§

Numpad7

7 Home on a keyboard
7 PQRS or 7 PRS on a phone or remote control

§

Numpad8

8 ↑ on a keyboard
8 TUV on a phone or remote control

§

Numpad9

9 PgUp on a keyboard
9 WXYZ or 9 WXY on a phone or remote control

§

NumpadAdd

+

§

NumpadBackspace

Found on the Microsoft Natural Keyboard.

§

NumpadClear

C or AC (All Clear). Also for use with numpads that have a Clear key that is separate from the NumLock key. On the Mac, the numpad Clear key should always be encoded as “NumLock”.

§

NumpadClearEntry

CE (Clear Entry)

§

NumpadComma

, (thousands separator). For locales where the thousands separator is a “.” (e.g., Brazil), this key may generate a ..

§

NumpadDecimal

. Del. For locales where the decimal separator is “,” (e.g., Brazil), this key may generate a ,.

§

NumpadDivide

/

§

NumpadEnter

§

NumpadEqual

=

§

NumpadHash

# on a phone or remote control device. This key is typically found below the 9 key and to the right of the 0 key.

§

NumpadMemoryAdd

M+ Add current entry to the value stored in memory.

§

NumpadMemoryClear

MC Clear the value stored in memory.

§

NumpadMemoryRecall

MR Replace the current entry with the value stored in memory.

§

NumpadMemoryStore

MS Replace the value stored in memory with the current entry.

§

NumpadMemorySubtract

M- Subtract current entry from the value stored in memory.

§

NumpadMultiply

on a keyboard. For use with numpads that provide mathematical operations (+, -, and /).
Use “NumpadStar” for the * key on phones and remote controls.

§

NumpadParenLeft

( Found on the Microsoft Natural Keyboard.

§

NumpadParenRight

) Found on the Microsoft Natural Keyboard.

§

NumpadStar

on a phone or remote control device. This key is typically found below the 7 key and to the left of the 0 key.
Use “NumpadMultiply” for the
key on numeric keypads.

§

NumpadSubtract

-

§

Escape

Esc or

§

Fn

Fn This is typically a hardware key that does not generate a separate code. Most keyboards do not place this key in the function section, but it is included here to keep it with related keys.

§

FnLock

FLock or FnLock. Function Lock key. Found on the Microsoft Natural Keyboard.

§

PrintScreen

PrtScr SysRq or Print Screen

§

ScrollLock

Scroll Lock

§

Pause

Pause Break

§

BrowserBack

Some laptops place this key to the left of the key.

§

BrowserFavorites

§

BrowserForward

Some laptops place this key to the right of the key.

§

BrowserHome

§

BrowserRefresh

§

BrowserSearch

§

BrowserStop

§

Eject

Eject or . This key is placed in the function section on some Apple keyboards.

§

LaunchApp1

Sometimes labelled My Computer on the keyboard

§

LaunchApp2

Sometimes labelled Calculator on the keyboard

§

LaunchMail

§

MediaPlayPause

§

MediaSelect

§

MediaStop

§

MediaTrackNext

§

MediaTrackPrevious

§

Power

This key is placed in the function section on some Apple keyboards, replacing the Eject key.

§

Sleep

§

AudioVolumeDown

§

AudioVolumeMute

§

AudioVolumeUp

§

WakeUp

§

Hyper

§

Super

§

Turbo

§

Abort

§

Resume

§

Suspend

§

Again

Found on Sun’s USB keyboard.

§

Copy

Found on Sun’s USB keyboard.

§

Cut

Found on Sun’s USB keyboard.

§

Find

Found on Sun’s USB keyboard.

§

Open

Found on Sun’s USB keyboard.

§

Paste

Found on Sun’s USB keyboard.

§

Props

Found on Sun’s USB keyboard.

§

Select

Found on Sun’s USB keyboard.

§

Undo

Found on Sun’s USB keyboard.

§

Hiragana

Use for dedicated ひらがな key found on some Japanese word processing keyboards.

§

Katakana

Use for dedicated カタカナ key found on some Japanese word processing keyboards.

§

Unidentified

This value code should be used when no other value given in this specification is appropriate.

§

F1

F1

§

F2

F2

§

F3

F3

§

F4

F4

§

F5

F5

§

F6

F6

§

F7

F7

§

F8

F8

§

F9

F9

§

F10

F10

§

F11

F11

§

F12

F12

§

F13

F13

§

F14

F14

§

F15

F15

§

F16

F16

§

F17

F17

§

F18

F18

§

F19

F19

§

F20

F20

§

F21

F21

§

F22

F22

§

F23

F23

§

F24

F24

§

F25

F25

§

F26

F26

§

F27

F27

§

F28

F28

§

F29

F29

§

F30

F30

§

F31

F31

§

F32

F32

§

F33

F33

§

F34

F34

§

F35

F35

§

BrightnessDown

Non-standard code value supported by Chromium.

§

BrightnessUp

Non-standard code value supported by Chromium.

§

DisplayToggleIntExt

Non-standard code value supported by Chromium.

§

KeyboardLayoutSelect

Non-standard code value supported by Chromium.

§

LaunchAssistant

Non-standard code value supported by Chromium.

§

LaunchControlPanel

Non-standard code value supported by Chromium.

§

LaunchScreenSaver

Non-standard code value supported by Chromium.

§

MailForward

Non-standard code value supported by Chromium.

§

MailReply

Non-standard code value supported by Chromium.

§

MailSend

Non-standard code value supported by Chromium.

§

MediaFastForward

Non-standard code value supported by Chromium.

§

MediaPause

Non-standard code value supported by Chromium.

§

MediaPlay

Non-standard code value supported by Chromium.

§

MediaRecord

Non-standard code value supported by Chromium.

§

MediaRewind

Non-standard code value supported by Chromium.

§

MicrophoneMuteToggle

Non-standard code value supported by Chromium.

§

PrivacyScreenToggle

Non-standard code value supported by Chromium.

§

SelectTask

Non-standard code value supported by Chromium.

§

ShowAllWindows

Non-standard code value supported by Chromium.

§

ZoomToggle

Non-standard code value supported by Chromium.

Trait Implementations§

source§

impl Clone for Code

source§

fn clone(&self) -> Code

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 Code

source§

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

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

impl Default for Code

source§

fn default() -> Code

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

impl<'de> Deserialize<'de> for Code

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 Display for Code

source§

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

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

impl FromStr for Code

§

type Err = UnrecognizedCodeError

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 Hash for Code

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Code

source§

fn eq(&self, other: &Code) -> 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 Serialize for Code

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 Copy for Code

source§

impl Eq for Code

source§

impl StructuralPartialEq for Code

Auto Trait Implementations§

§

impl Freeze for Code

§

impl RefUnwindSafe for Code

§

impl Send for Code

§

impl Sync for Code

§

impl Unpin for Code

§

impl UnwindSafe for Code

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

§

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§

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

§

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

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,