Skip to main content

Key

Enum Key 

Source
#[repr(i32)]
pub enum Key {
Show 194 variants None = 0, Cancel = 1, Back = 2, Tab = 3, LineFeed = 4, Clear = 5, Return = 6, Pause = 7, CapsLock = 8, HangulMode = 9, JunjaMode = 10, FinalMode = 11, KanjiMode = 12, Escape = 13, ImeConvert = 14, ImeNonConvert = 15, ImeAccept = 16, ImeModeChange = 17, Space = 18, PageUp = 19, PageDown = 20, End = 21, Home = 22, Left = 23, Up = 24, Right = 25, Down = 26, Select = 27, Print = 28, Execute = 29, Snapshot = 30, Insert = 31, Delete = 32, Help = 33, D0 = 34, D1 = 35, D2 = 36, D3 = 37, D4 = 38, D5 = 39, D6 = 40, D7 = 41, D8 = 42, D9 = 43, A = 44, B = 45, C = 46, D = 47, E = 48, F = 49, G = 50, H = 51, I = 52, J = 53, K = 54, L = 55, M = 56, N = 57, O = 58, P = 59, Q = 60, R = 61, S = 62, T = 63, U = 64, V = 65, W = 66, X = 67, Y = 68, Z = 69, LWin = 70, RWin = 71, Apps = 72, Sleep = 73, NumPad0 = 74, NumPad1 = 75, NumPad2 = 76, NumPad3 = 77, NumPad4 = 78, NumPad5 = 79, NumPad6 = 80, NumPad7 = 81, NumPad8 = 82, NumPad9 = 83, Multiply = 84, Add = 85, Separator = 86, Subtract = 87, Decimal = 88, Divide = 89, F1 = 90, F2 = 91, F3 = 92, F4 = 93, F5 = 94, F6 = 95, F7 = 96, F8 = 97, F9 = 98, F10 = 99, F11 = 100, F12 = 101, F13 = 102, F14 = 103, F15 = 104, F16 = 105, F17 = 106, F18 = 107, F19 = 108, F20 = 109, F21 = 110, F22 = 111, F23 = 112, F24 = 113, NumLock = 114, Scroll = 115, LeftShift = 116, RightShift = 117, LeftCtrl = 118, RightCtrl = 119, LeftAlt = 120, RightAlt = 121, BrowserBack = 122, BrowserForward = 123, BrowserRefresh = 124, BrowserStop = 125, BrowserSearch = 126, BrowserFavorites = 127, BrowserHome = 128, VolumeMute = 129, VolumeDown = 130, VolumeUp = 131, MediaNextTrack = 132, MediaPreviousTrack = 133, MediaStop = 134, MediaPlayPause = 135, LaunchMail = 136, SelectMedia = 137, LaunchApplication1 = 138, LaunchApplication2 = 139, OemSemicolon = 140, OemPlus = 141, OemComma = 142, OemMinus = 143, OemPeriod = 144, OemQuestion = 145, OemTilde = 146, AbntC1 = 147, AbntC2 = 148, OemOpenBrackets = 149, OemPipe = 150, OemCloseBrackets = 151, OemQuotes = 152, Oem8 = 153, OemBackslash = 154, ImeProcessed = 155, System = 156, OemAttn = 157, OemFinish = 158, DbeHiragana = 159, DbeSbcsChar = 160, DbeDbcsChar = 161, OemBackTab = 162, DbeNoRoman = 163, CrSel = 164, ExSel = 165, EraseEof = 166, Play = 167, DbeNoCodeInput = 168, NoName = 169, DbeEnterDialogConversionMode = 170, OemClear = 171, DeadCharProcessed = 172, FnLeftArrow = 10_001, FnRightArrow = 10_002, FnUpArrow = 10_003, FnDownArrow = 10_004, MediaHome = 100_000, MediaChannelList = 100_001, MediaChannelRaise = 100_002, MediaChannelLower = 100_003, MediaRecord = 100_005, MediaRed = 100_010, MediaGreen = 100_011, MediaYellow = 100_012, MediaBlue = 100_013, MediaMenu = 100_020, MediaMore = 100_021, MediaOption = 100_022, MediaInfo = 100_023, MediaSearch = 100_024, MediaSubtitle = 100_025, MediaTvGuide = 100_026, MediaPreviousChannel = 100_027,
}
Expand description

Defines the keys available on a keyboard.

Variants§

§

None = 0

No key pressed.

§

Cancel = 1

The Cancel key.

§

Back = 2

The Back key.

§

Tab = 3

The Tab key.

§

LineFeed = 4

The Linefeed key.

§

Clear = 5

The Clear key.

§

Return = 6

The Return key.

§

Pause = 7

The Pause key.

§

CapsLock = 8

The Caps Lock key.

§

HangulMode = 9

The IME Hangul mode key.

§

JunjaMode = 10

The IME Junja mode key.

§

FinalMode = 11

The IME Final mode key.

§

KanjiMode = 12

The IME Kanji mode key.

§

Escape = 13

The Escape key.

§

ImeConvert = 14

The IME Convert key.

§

ImeNonConvert = 15

The IME NonConvert key.

§

ImeAccept = 16

The IME Accept key.

§

ImeModeChange = 17

The IME Mode change key.

§

Space = 18

The space bar.

§

PageUp = 19

The Page Up key.

§

PageDown = 20

The Page Down key.

§

End = 21

The End key.

§

Home = 22

The Home key.

§

Left = 23

The Left arrow key.

§

Up = 24

The Up arrow key.

§

Right = 25

The Right arrow key.

§

Down = 26

The Down arrow key.

§

Select = 27

The Select key.

§

Print = 28

The Print key.

§

Execute = 29

The Execute key.

§

Snapshot = 30

The Print Screen key.

§

Insert = 31

The Insert key.

§

Delete = 32

The Delete key.

§

Help = 33

The Help key.

§

D0 = 34

The 0 key.

§

D1 = 35

The 1 key.

§

D2 = 36

The 2 key.

§

D3 = 37

The 3 key.

§

D4 = 38

The 4 key.

§

D5 = 39

The 5 key.

§

D6 = 40

The 6 key.

§

D7 = 41

The 7 key.

§

D8 = 42

The 8 key.

§

D9 = 43

The 9 key.

§

A = 44

The A key.

§

B = 45

The B key.

§

C = 46

The C key.

§

D = 47

The D key.

§

E = 48

The E key.

§

F = 49

The F key.

§

G = 50

The G key.

§

H = 51

The H key.

§

I = 52

The I key.

§

J = 53

The J key.

§

K = 54

The K key.

§

L = 55

The L key.

§

M = 56

The M key.

§

N = 57

The N key.

§

O = 58

The O key.

§

P = 59

The P key.

§

Q = 60

The Q key.

§

R = 61

The R key.

§

S = 62

The S key.

§

T = 63

The T key.

§

U = 64

The U key.

§

V = 65

The V key.

§

W = 66

The W key.

§

X = 67

The X key.

§

Y = 68

The Y key.

§

Z = 69

The Z key.

§

LWin = 70

The left Windows key.

§

RWin = 71

The right Windows key.

§

Apps = 72

The Application key.

§

Sleep = 73

The Sleep key.

§

NumPad0 = 74

The 0 key on the numeric keypad.

§

NumPad1 = 75

The 1 key on the numeric keypad.

§

NumPad2 = 76

The 2 key on the numeric keypad.

§

NumPad3 = 77

The 3 key on the numeric keypad.

§

NumPad4 = 78

The 4 key on the numeric keypad.

§

NumPad5 = 79

The 5 key on the numeric keypad.

§

NumPad6 = 80

The 6 key on the numeric keypad.

§

NumPad7 = 81

The 7 key on the numeric keypad.

§

NumPad8 = 82

The 8 key on the numeric keypad.

§

NumPad9 = 83

The 9 key on the numeric keypad.

§

Multiply = 84

The Multiply key.

§

Add = 85

The Add key.

§

Separator = 86

The Separator key.

§

Subtract = 87

The Subtract key.

§

Decimal = 88

The Decimal key.

§

Divide = 89

The Divide key.

§

F1 = 90

The F1 key.

§

F2 = 91

The F2 key.

§

F3 = 92

The F3 key.

§

F4 = 93

The F4 key.

§

F5 = 94

The F5 key.

§

F6 = 95

The F6 key.

§

F7 = 96

The F7 key.

§

F8 = 97

The F8 key.

§

F9 = 98

The F9 key.

§

F10 = 99

The F10 key.

§

F11 = 100

The F11 key.

§

F12 = 101

The F12 key.

§

F13 = 102

The F13 key.

§

F14 = 103

The F14 key.

§

F15 = 104

The F15 key.

§

F16 = 105

The F16 key.

§

F17 = 106

The F17 key.

§

F18 = 107

The F18 key.

§

F19 = 108

The F19 key.

§

F20 = 109

The F20 key.

§

F21 = 110

The F21 key.

§

F22 = 111

The F22 key.

§

F23 = 112

The F23 key.

§

F24 = 113

The F24 key.

§

NumLock = 114

The Numlock key.

§

Scroll = 115

The Scroll key.

§

LeftShift = 116

The left Shift key.

§

RightShift = 117

The right Shift key.

§

LeftCtrl = 118

The left Ctrl key.

§

RightCtrl = 119

The right Ctrl key.

§

LeftAlt = 120

The left Alt key.

§

RightAlt = 121

The right Alt key.

§

BrowserBack = 122

The browser Back key.

§

BrowserForward = 123

The browser Forward key.

§

BrowserRefresh = 124

The browser Refresh key.

§

BrowserStop = 125

The browser Stop key.

§

BrowserSearch = 126

The browser Search key.

§

BrowserFavorites = 127

The browser Favorites key.

§

BrowserHome = 128

The browser Home key.

§

VolumeMute = 129

The Volume Mute key.

§

VolumeDown = 130

The Volume Down key.

§

VolumeUp = 131

The Volume Up key.

§

MediaNextTrack = 132

The media Next Track key.

§

MediaPreviousTrack = 133

The media Previous Track key.

§

MediaStop = 134

The media Stop key.

§

MediaPlayPause = 135

The media Play/Pause key.

§

LaunchMail = 136

The Launch Mail key.

§

SelectMedia = 137

The Select Media key.

§

LaunchApplication1 = 138

The Launch Application 1 key.

§

LaunchApplication2 = 139

The Launch Application 2 key.

§

OemSemicolon = 140

The OEM Semicolon key.

§

OemPlus = 141

The OEM Plus key.

§

OemComma = 142

The OEM Comma key.

§

OemMinus = 143

The OEM Minus key.

§

OemPeriod = 144

The OEM Period key.

§

OemQuestion = 145

The OEM Question Mark key.

§

OemTilde = 146

The OEM Tilde key.

§

AbntC1 = 147

The ABNT_C1 (Brazilian) key.

§

AbntC2 = 148

The ABNT_C2 (Brazilian) key.

§

OemOpenBrackets = 149

The OEM Open Brackets key.

§

OemPipe = 150

The OEM Pipe key.

§

OemCloseBrackets = 151

The OEM Close Brackets key.

§

OemQuotes = 152

The OEM Quotes key.

§

Oem8 = 153

The OEM 8 key.

§

OemBackslash = 154

The OEM Backslash key.

§

ImeProcessed = 155

A special key masking the real key being processed by an IME.

§

System = 156

A special key masking the real key being processed as a system key.

§

OemAttn = 157

The OEM ATTN key.

§

OemFinish = 158

The OEM Finish key.

§

DbeHiragana = 159

The DBE_HIRAGANA key.

§

DbeSbcsChar = 160

The DBE_SBCSCHAR key.

§

DbeDbcsChar = 161

The DBE_DBCSCHAR key.

§

OemBackTab = 162

The OEM BackTab key.

§

DbeNoRoman = 163

The DBE_NOROMAN key.

§

CrSel = 164

The CRSEL key.

§

ExSel = 165

The EXSEL key.

§

EraseEof = 166

The ERASE EOF Key.

§

Play = 167

The Play key.

§

DbeNoCodeInput = 168

The DBE_NOCODEINPUT key.

§

NoName = 169

Reserved for future use.

§

DbeEnterDialogConversionMode = 170

The DBE_ENTERDLGCONVERSIONMODE key.

§

OemClear = 171

The OEM Clear key.

§

DeadCharProcessed = 172

The key is used with another key to create a single combined character.

§

FnLeftArrow = 10_001

OSX Platform-specific Fn+Left key

§

FnRightArrow = 10_002

OSX Platform-specific Fn+Right key

§

FnUpArrow = 10_003

OSX Platform-specific Fn+Up key

§

FnDownArrow = 10_004

OSX Platform-specific Fn+Down key

§

MediaHome = 100_000

Remove control home button

§

MediaChannelList = 100_001

TV Channel up

§

MediaChannelRaise = 100_002

TV Channel up

§

MediaChannelLower = 100_003

TV Channel down

§

MediaRecord = 100_005

TV Channel down

§

MediaRed = 100_010

Remote control Red button

§

MediaGreen = 100_011

Remote control Green button

§

MediaYellow = 100_012

Remote control Yellow button

§

MediaBlue = 100_013

Remote control Blue button

§

MediaMenu = 100_020

Remote control Menu button

§

MediaMore = 100_021

Remote control dots button

§

MediaOption = 100_022

Remote control option button

§

MediaInfo = 100_023

Remote control channel info button

§

MediaSearch = 100_024

Remote control search button

§

MediaSubtitle = 100_025

Remote control subtitle/caption button

§

MediaTvGuide = 100_026

Remote control Tv guide detail button

§

MediaPreviousChannel = 100_027

Remote control Previous Channel

Implementations§

Source§

impl Key

Source

pub const Enter: Key = Key::Return

The Enter key.

Source

pub const Capital: Key = Key::CapsLock

The Caps Lock key.

Source

pub const KanaMode: Key = Key::HangulMode

The IME Kana mode key.

Source

pub const HanjaMode: Key = Key::KanjiMode

The IME Hanja mode key.

Source

pub const Prior: Key = Key::PageUp

The Page Up key.

Source

pub const Next: Key = Key::PageDown

The Page Down key.

Source

pub const PrintScreen: Key = Key::Snapshot

The Print Screen key.

Source

pub const Oem1: Key = Key::OemSemicolon

The OEM 1 key.

Source

pub const Oem2: Key = Key::OemQuestion

The OEM 2 key.

Source

pub const Oem3: Key = Key::OemTilde

The OEM 3 key.

Source

pub const Oem4: Key = Key::OemOpenBrackets

The OEM 4 key.

Source

pub const Oem5: Key = Key::OemPipe

The OEM 5 key.

Source

pub const Oem6: Key = Key::OemCloseBrackets

The OEM 6 key.

Source

pub const Oem7: Key = Key::OemQuotes

The OEM 7 key.

Source

pub const Oem102: Key = Key::OemBackslash

The OEM 3 key.

Source

pub const DbeAlphanumeric: Key = Key::OemAttn

The DBE_ALPHANUMERIC key.

Source

pub const DbeKatakana: Key = Key::OemFinish

The DBE_KATAKANA key.

Source

pub const OemCopy: Key = Key::DbeHiragana

The OEM Copy key.

Source

pub const OemAuto: Key = Key::DbeSbcsChar

The OEM Auto key.

Source

pub const OemEnlw: Key = Key::DbeDbcsChar

The OEM ENLW key.

Source

pub const DbeRoman: Key = Key::OemBackTab

The DBE_ROMAN key.

Source

pub const Attn: Key = Key::DbeNoRoman

The ATTN key.

Source

pub const DbeEnterWordRegisterMode: Key = Key::CrSel

The DBE_ENTERWORDREGISTERMODE key.

Source

pub const DbeEnterImeConfigureMode: Key = Key::ExSel

The DBE_ENTERIMECONFIGMODE key.

Source

pub const DbeFlushString: Key = Key::EraseEof

The DBE_FLUSHSTRING key.

Source

pub const DbeCodeInput: Key = Key::Play

The DBE_CODEINPUT key.

Source

pub const Zoom: Key = Key::DbeNoCodeInput

The Zoom key.

Source

pub const DbeDetermineString: Key = Key::NoName

The DBE_DETERMINESTRING key.

Source

pub const Pa1: Key = Key::DbeEnterDialogConversionMode

The PA1 key.

Source

pub const fn value(self) -> i32

The numeric value of the member.

Source

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

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

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

Source§

impl Key

Source

pub fn to_navigation_direction( self, modifiers: KeyModifiers, ) -> Option<NavigationDirection>

Converts a keypress into a navigation direction, if the key is a navigation key.

Trait Implementations§

Source§

impl Clone for Key

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 Key

Source§

impl Debug for Key

Source§

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

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

impl Default for Key

Source§

fn default() -> Self

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

impl Display for Key

Source§

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

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

impl Eq for Key

Source§

impl FromStr for Key

Source§

type Err = ParseKeyError

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 Key

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 MarkupTyped for Key

Source§

const MARKUP: &'static MarkupType

The markup metadata of the type.
Source§

impl Ord for Key

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 Key

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 Key

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 Key

Auto Trait Implementations§

§

impl Freeze for Key

§

impl RefUnwindSafe for Key

§

impl Send for Key

§

impl Sync for Key

§

impl Unpin for Key

§

impl UnsafeUnpin for Key

§

impl UnwindSafe for Key

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> AnyValue for T
where T: PartialEq + 'static,

Source§

fn any_value_as_any(&self) -> &(dyn Any + 'static)

Source§

fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool

Source§

fn any_value_type_name(&self) -> &'static str

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). 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> PropertyValue for T
where T: Clone + PartialEq + 'static,

Source§

impl<T> ResourceKeyObject for T
where T: Eq + Hash + 'static,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn dyn_eq(&self, other: &(dyn ResourceKeyObject + 'static)) -> bool

Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

Source§

fn key_type_name(&self) -> &'static str

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.