Skip to main content

PhysicalKey

Enum PhysicalKey 

Source
#[repr(i32)]
pub enum PhysicalKey {
Show 165 variants None = 0, Backquote = 1, Backslash = 2, BracketLeft = 3, BracketRight = 4, Comma = 5, Digit0 = 6, Digit1 = 7, Digit2 = 8, Digit3 = 9, Digit4 = 10, Digit5 = 11, Digit6 = 12, Digit7 = 13, Digit8 = 14, Digit9 = 15, Equal = 16, IntlBackslash = 17, IntlRo = 18, IntlYen = 19, A = 20, B = 21, C = 22, D = 23, E = 24, F = 25, G = 26, H = 27, I = 28, J = 29, K = 30, L = 31, M = 32, N = 33, O = 34, P = 35, Q = 36, R = 37, S = 38, T = 39, U = 40, V = 41, W = 42, X = 43, Y = 44, Z = 45, Minus = 46, Period = 47, Quote = 48, Semicolon = 49, Slash = 50, AltLeft = 51, AltRight = 52, Backspace = 53, CapsLock = 54, ContextMenu = 55, ControlLeft = 56, ControlRight = 57, Enter = 58, MetaLeft = 59, MetaRight = 60, ShiftLeft = 61, ShiftRight = 62, Space = 63, Tab = 64, Convert = 65, KanaMode = 66, Lang1 = 67, Lang2 = 68, Lang3 = 69, Lang4 = 70, Lang5 = 71, NonConvert = 72, Delete = 73, End = 74, Help = 75, Home = 76, Insert = 77, PageDown = 78, PageUp = 79, ArrowDown = 80, ArrowLeft = 81, ArrowRight = 82, ArrowUp = 83, NumLock = 84, NumPad0 = 85, NumPad1 = 86, NumPad2 = 87, NumPad3 = 88, NumPad4 = 89, NumPad5 = 90, NumPad6 = 91, NumPad7 = 92, NumPad8 = 93, NumPad9 = 94, NumPadAdd = 95, NumPadClear = 96, NumPadComma = 97, NumPadDecimal = 98, NumPadDivide = 99, NumPadEnter = 100, NumPadEqual = 101, NumPadMultiply = 102, NumPadParenLeft = 103, NumPadParenRight = 104, NumPadSubtract = 105, Escape = 106, F1 = 107, F2 = 108, F3 = 109, F4 = 110, F5 = 111, F6 = 112, F7 = 113, F8 = 114, F9 = 115, F10 = 116, F11 = 117, F12 = 118, F13 = 119, F14 = 120, F15 = 121, F16 = 122, F17 = 123, F18 = 124, F19 = 125, F20 = 126, F21 = 127, F22 = 128, F23 = 129, F24 = 130, PrintScreen = 131, ScrollLock = 132, Pause = 133, BrowserBack = 134, BrowserFavorites = 135, BrowserForward = 136, BrowserHome = 137, BrowserRefresh = 138, BrowserSearch = 139, BrowserStop = 140, Eject = 141, LaunchApp1 = 142, LaunchApp2 = 143, LaunchMail = 144, MediaPlayPause = 145, MediaSelect = 146, MediaStop = 147, MediaTrackNext = 148, MediaTrackPrevious = 149, Power = 150, Sleep = 151, AudioVolumeDown = 152, AudioVolumeMute = 153, AudioVolumeUp = 154, WakeUp = 155, Again = 156, Copy = 157, Cut = 158, Find = 159, Open = 160, Paste = 161, Props = 162, Select = 163, Undo = 164,
}
Expand description

Represents a keyboard physical key.

The names follow the W3C codes, see https://www.w3.org/TR/uievents-code/.

Variants§

§

None = 0

Represents no key.

§

Backquote = 1

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

§

Backslash = 2

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. #~ on a UK (102) keyboard.

§

BracketLeft = 3

[{ on a US keyboard.

§

BracketRight = 4

]} on a US keyboard.

§

Comma = 5

,< on a US keyboard.

§

Digit0 = 6

0) on a US keyboard.

§

Digit1 = 7

1! on a US keyboard.

§

Digit2 = 8

2@ on a US keyboard.

§

Digit3 = 9

3# on a US keyboard.

§

Digit4 = 10

4$ on a US keyboard.

§

Digit5 = 11

5% on a US keyboard.

§

Digit6 = 12

6^ on a US keyboard.

§

Digit7 = 13

7& on a US keyboard.

§

Digit8 = 14

8* on a US keyboard.

§

Digit9 = 15

9( on a US keyboard.

§

Equal = 16

=+ on a US keyboard.

§

IntlBackslash = 17

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

§

IntlRo = 18

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

§

IntlYen = 19

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

§

A = 20

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

§

B = 21

b on a US keyboard.

§

C = 22

c on a US keyboard.

§

D = 23

d on a US keyboard.

§

E = 24

e on a US keyboard.

§

F = 25

f on a US keyboard.

§

G = 26

g on a US keyboard.

§

H = 27

h on a US keyboard.

§

I = 28

i on a US keyboard.

§

J = 29

j on a US keyboard.

§

K = 30

k on a US keyboard.

§

L = 31

l on a US keyboard.

§

M = 32

m on a US keyboard.

§

N = 33

n on a US keyboard.

§

O = 34

o on a US keyboard.

§

P = 35

p on a US keyboard.

§

Q = 36

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

§

R = 37

r on a US keyboard.

§

S = 38

s on a US keyboard.

§

T = 39

t on a US keyboard.

§

U = 40

u on a US keyboard.

§

V = 41

v on a US keyboard.

§

W = 42

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

§

X = 43

x on a US keyboard.

§

Y = 44

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

§

Z = 45

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

§

Minus = 46

-_ on a US keyboard.

§

Period = 47

.> on a US keyboard.

§

Quote = 48

'" on a US keyboard.

§

Semicolon = 49

;: on a US keyboard.

§

Slash = 50

/? on a US keyboard.

§

AltLeft = 51

Alt, Option or ⌥.

§

AltRight = 52

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

§

Backspace = 53

Backspace or ⌫. Labelled Delete on Apple keyboards.

§

CapsLock = 54

CapsLock or ⇪.

§

ContextMenu = 55

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

§

ControlLeft = 56

Control or ⌃.

§

ControlRight = 57

Control or ⌃.

§

Enter = 58

Enter or ↵. Labelled Return on Apple keyboards.

§

MetaLeft = 59

The ⊞ (Windows), ⌘, Command or other OS symbol key.

§

MetaRight = 60

The ⊞ (Windows), ⌘, Command or other OS symbol key.

§

ShiftLeft = 61

Shift or ⇧.

§

ShiftRight = 62

Shift or ⇧.

§

Space = 63

(space).

§

Tab = 64

Tab or ⇥.

§

Convert = 65

Japanese: 変換 (henkan).

§

KanaMode = 66

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

§

Lang1 = 67

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

§

Lang2 = 68

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

§

Lang3 = 69

Japanese (word-processing keyboard): Katakana.

§

Lang4 = 70

Japanese (word-processing keyboard): Hiragana.

§

Lang5 = 71

Japanese (word-processing keyboard): Zenkaku/Hankaku.

§

NonConvert = 72

Japanese: 無変換 (muhenkan).

§

Delete = 73

⌦. The forward delete key. Note that on Apple keyboards, the key labelled Delete on the main part of the keyboard is Backspace.

§

End = 74

End or ↘.

§

Help = 75

Help. Not present on standard PC keyboards.

§

Home = 76

Home or ↖.

§

Insert = 77

Insert or Ins. Not present on Apple keyboards.

§

PageDown = 78

Page Down, PgDn or ⇟.

§

PageUp = 79

Page Up, PgUp or ⇞.

§

ArrowDown = 80

↓.

§

ArrowLeft = 81

←.

§

ArrowRight = 82

→.

§

ArrowUp = 83

↑.

§

NumLock = 84

Numeric keypad Num Lock. On the Mac, this is used for the numpad Clear key.

§

NumPad0 = 85

Numeric keypad 0 Ins on a keyboard. 0 on a phone or remote control.

§

NumPad1 = 86

Numeric keypad 1 End on a keyboard. 1 or 1 QZ on a phone or remote control.

§

NumPad2 = 87

Numeric keypad 2 ↓ on a keyboard. 2 ABC on a phone or remote control.

§

NumPad3 = 88

Numeric keypad 3 PgDn on a keyboard. 3 DEF on a phone or remote control.

§

NumPad4 = 89

Numeric keypad 4 ← on a keyboard. 4 GHI on a phone or remote control.

§

NumPad5 = 90

Numeric keypad 5 on a keyboard. 5 JKL on a phone or remote control.

§

NumPad6 = 91

Numeric keypad 6 → on a keyboard. 6 MNO on a phone or remote control.

§

NumPad7 = 92

Numeric keypad 7 Home on a keyboard. 7 PQRS or 7 PRS on a phone or remote control.

§

NumPad8 = 93

Numeric keypad 8 ↑ on a keyboard. 8 TUV on a phone or remote control.

§

NumPad9 = 94

Numeric keypad 9 PgUp on a keyboard. 9 WXYZ or 9 WXY on a phone or remote control.

§

NumPadAdd = 95

Numeric keypad +.

§

NumPadClear = 96

Numeric keypad 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 is NumLock.

§

NumPadComma = 97

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

§

NumPadDecimal = 98

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

§

NumPadDivide = 99

Numeric keypad /.

§

NumPadEnter = 100

Numeric keypad Enter.

§

NumPadEqual = 101

Numeric keypad =.

§

NumPadMultiply = 102

Numeric keypad * on a keyboard. For use with numpads that provide mathematical operations (+, -, * and /).

§

NumPadParenLeft = 103

Numeric keypad (. Found on the Microsoft Natural Keyboard.

§

NumPadParenRight = 104

Numeric keypad ). Found on the Microsoft Natural Keyboard.

§

NumPadSubtract = 105

Numeric keypad -.

§

Escape = 106

Esc or ⎋.

§

F1 = 107

F1.

§

F2 = 108

F2.

§

F3 = 109

F3.

§

F4 = 110

F4.

§

F5 = 111

F5.

§

F6 = 112

F6.

§

F7 = 113

F7.

§

F8 = 114

F8.

§

F9 = 115

F9.

§

F10 = 116

F10.

§

F11 = 117

F11.

§

F12 = 118

F12.

§

F13 = 119

F13.

§

F14 = 120

F14.

§

F15 = 121

F15.

§

F16 = 122

F16.

§

F17 = 123

F17.

§

F18 = 124

F18.

§

F19 = 125

F19.

§

F20 = 126

F20.

§

F21 = 127

F21.

§

F22 = 128

F22.

§

F23 = 129

F23.

§

F24 = 130

F24.

§

PrintScreen = 131

PrtScr SysRq or Print Screen.

§

ScrollLock = 132

Scroll Lock.

§

Pause = 133

Pause Break.

§

BrowserBack = 134

Browser Back. Some laptops place this key to the left of the ↑ key.

§

BrowserFavorites = 135

Browser Favorites.

§

BrowserForward = 136

Browser Forward. Some laptops place this key to the right of the ↑ key.

§

BrowserHome = 137

Browser Home.

§

BrowserRefresh = 138

Browser Refresh.

§

BrowserSearch = 139

Browser Search.

§

BrowserStop = 140

Browser Stop.

§

Eject = 141

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

§

LaunchApp1 = 142

App 1. Sometimes labelled My Computer on the keyboard.

§

LaunchApp2 = 143

App 2. Sometimes labelled Calculator on the keyboard.

§

LaunchMail = 144

Mail.

§

MediaPlayPause = 145

Media Play/Pause or ⏵⏸.

§

MediaSelect = 146

Media Select.

§

MediaStop = 147

Media Stop or ⏹.

§

MediaTrackNext = 148

Media Next or ⏭.

§

MediaTrackPrevious = 149

Media Previous or ⏮.

§

Power = 150

Power.

§

Sleep = 151

Sleep.

§

AudioVolumeDown = 152

Volume Down.

§

AudioVolumeMute = 153

Mute.

§

AudioVolumeUp = 154

Volume Up.

§

WakeUp = 155

Wake Up.

§

Again = 156

Again. Legacy. Found on Sun’s USB keyboard.

§

Copy = 157

Copy. Legacy. Found on Sun’s USB keyboard.

§

Cut = 158

Cut. Legacy. Found on Sun’s USB keyboard.

§

Find = 159

Find. Legacy. Found on Sun’s USB keyboard.

§

Open = 160

Open. Legacy. Found on Sun’s USB keyboard.

§

Paste = 161

Paste. Legacy. Found on Sun’s USB keyboard.

§

Props = 162

Props. Legacy. Found on Sun’s USB keyboard.

§

Select = 163

Select. Legacy. Found on Sun’s USB keyboard.

§

Undo = 164

Undo. Legacy. Found on Sun’s USB keyboard.

Implementations§

Source§

impl PhysicalKey

Source

pub const fn value(self) -> i32

The numeric value of the member.

Source

pub fn from_value(value: i32) -> Option<PhysicalKey>

The member with the given numeric value, if one is defined.

Source

pub fn name(self) -> &'static str

The name of the member. For values with several names this is the first one declared.

Source

pub fn parse(s: &str) -> Result<PhysicalKey, ParsePhysicalKeyError>

Parses a member name (ignoring case, aliases included) or the numeric value of a defined member.

Trait Implementations§

Source§

impl BsonValue for PhysicalKey

Source§

const TYPE: Type

typeof(T).
Source§

fn as_value(&self) -> ValueRef<'_>

The value as the serializer receives it: boxing, without a copy.
Source§

fn from_value(value: Value) -> Result<Self, Error>

The cast of a deserialized value to the type of the property it is assigned to. The deserializer does not assign null.
Source§

impl Clone for PhysicalKey

Source§

fn clone(&self) -> Self

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 PhysicalKey

Source§

impl Debug for PhysicalKey

Source§

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

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

impl Default for PhysicalKey

Source§

fn default() -> Self

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

impl Display for PhysicalKey

Source§

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

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

impl Eq for PhysicalKey

Source§

impl FromStr for PhysicalKey

Source§

type Err = ParsePhysicalKeyError

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 PhysicalKey

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 Ord for PhysicalKey

Source§

fn cmp(&self, other: &Self) -> 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§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for PhysicalKey

Source§

fn eq(&self, other: &Self) -> 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 PhysicalKey

Source§

fn partial_cmp(&self, other: &Self) -> 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 StructuralPartialEq for PhysicalKey

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> ToOwned for T
where T: Clone,

Source§

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§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.