Key

Enum Key 

Source
#[non_exhaustive]
#[repr(u8)]
pub enum Key {
Show 85 variants Back = 0, One = 1, Two = 2, Three = 3, Four = 4, Five = 5, Six = 6, Seven = 7, Eight = 8, Nine = 9, Zero = 10, Minus = 11, Equal = 12, Backtick = 13, Tab = 14, Q = 15, W = 16, E = 17, R = 18, T = 19, Y = 20, U = 21, I = 22, O = 23, P = 24, BracketOpen = 25, BracketClose = 26, Backspace = 27, Env = 28, A = 29, S = 30, D = 31, F = 32, G = 33, H = 34, J = 35, K = 36, L = 37, Semicolon = 38, Apostrophe = 39, Enter = 40, LShift = 41, Z = 42, X = 43, C = 44, V = 45, B = 46, N = 47, M = 48, Comma = 49, Period = 50, Slash = 51, Backslash = 52, Up = 53, RShift = 54, LCtrl = 55, LAlt = 56, Space = 57, Compose = 58, RAlt = 59, RCtrl = 60, Left = 61, Down = 62, Right = 63, F1 = 65, F2 = 66, F3 = 67, F4 = 68, F5 = 69, F6 = 70, F7 = 71, F8 = 72, F9 = 73, F10 = 74, F11 = 75, F12 = 76, Insert = 77, Delete = 91, CapsLock = 92, PageUp = 117, Pause = 121, Menu = 124, Home = 125, PageDown = 126, End = 127,
}
Expand description

Input keycode for a key on a keyboard.

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

Back = 0

Also known as the ESCAPE key.

§

One = 1

Numeric 1 on either top row or numpad.

§

Two = 2

Numeric 2 on either top row or numpad.

§

Three = 3

Numeric 3 on either top row or numpad.

§

Four = 4

Numeric 4 on either top row or numpad.

§

Five = 5

Numeric 5 on either top row or numpad.

§

Six = 6

Numeric 6 on either top row or numpad.

§

Seven = 7

Numeric 7 on either top row or numpad.

§

Eight = 8

Numeric 8 on either top row or numpad.

§

Nine = 9

Numeric 9 on either top row or numpad.

§

Zero = 10

Numeric 0 on either top row or numpad.

§

Minus = 11

Minus / Underscore Key

§

Equal = 12

Equal Sign / Plus Key

§

Backtick = 13

Backtick / Tilde Key

§

Tab = 14

Tab

§

Q = 15

Q (may be named by a different glyph depending on language of user).

§

W = 16

W (may be named by a different glyph depending on language of user).

§

E = 17

E (may be named by a different glyph depending on language of user).

§

R = 18

R (may be named by a different glyph depending on language of user).

§

T = 19

T (may be named by a different glyph depending on language of user).

§

Y = 20

Y (may be named by a different glyph depending on language of user).

§

U = 21

U (may be named by a different glyph depending on language of user).

§

I = 22

I (may be named by a different glyph depending on language of user).

§

O = 23

U (may be named by a different glyph depending on language of user).

§

P = 24

I (may be named by a different glyph depending on language of user).

§

BracketOpen = 25

[ (may be named by a different glyph depending on language of user).

§

BracketClose = 26

] (may be named by a different glyph depending on language of user).

§

Backspace = 27

Backspace.

§

Env = 28

Env (Also known as: Win, Super, Cmd, Search) Key

§

A = 29

A (may be named by a different glyph depending on language of user).

§

S = 30

S (may be named by a different glyph depending on language of user).

§

D = 31

D (may be named by a different glyph depending on language of user).

§

F = 32

F (may be named by a different glyph depending on language of user).

§

G = 33

G (may be named by a different glyph depending on language of user).

§

H = 34

H (may be named by a different glyph depending on language of user).

§

J = 35

J (may be named by a different glyph depending on language of user).

§

K = 36

K (may be named by a different glyph depending on language of user).

§

L = 37

L (may be named by a different glyph depending on language of user).

§

Semicolon = 38

; (may be named by a different glyph depending on language of user).

§

Apostrophe = 39

’ (may be named by a different glyph depending on language of user).

§

Enter = 40

Enter (Also Return).

§

LShift = 41

Left Shift Key

§

Z = 42

Z (may be named by a different glyph depending on language of user).

§

X = 43

X (may be named by a different glyph depending on language of user).

§

C = 44

C (may be named by a different glyph depending on language of user).

§

V = 45

V (may be named by a different glyph depending on language of user).

§

B = 46

B (may be named by a different glyph depending on language of user).

§

N = 47

N (may be named by a different glyph depending on language of user).

§

M = 48

M (may be named by a different glyph depending on language of user).

§

Comma = 49

, (may be named by a different glyph depending on language of user).

§

Period = 50

. (may be named by a different glyph depending on language of user).

§

Slash = 51

/ (may be named by a different glyph depending on language of user).

§

Backslash = 52

\ (may be named by a different glyph depending on language of user).

§

Up = 53

Up Arrow

§

RShift = 54

Right Shift Key

§

LCtrl = 55

Left control

§

LAlt = 56

Left alt

§

Space = 57

Space (or Left Thumb Button)

§

Compose = 58

Compose Key (Alt Gr, Right Thumb Button, NumLock, ScrLk Key)

§

RAlt = 59

Right Alt

§

RCtrl = 60

Right Control

§

Left = 61

Left Arrow Key

§

Down = 62

Down Arrow Key

§

Right = 63

Right Arrow Key

§

F1 = 65

F1 Key

§

F2 = 66

F2 Key

§

F3 = 67

F3 Key

§

F4 = 68

F4 Key

§

F5 = 69

F5 Key

§

F6 = 70

F6 Key

§

F7 = 71

F7 Key

§

F8 = 72

F8 Key

§

F9 = 73

F9 Key

§

F10 = 74

F10 Key

§

F11 = 75

F11 Key

§

F12 = 76

F12 Key

§

Insert = 77

Insert Key

§

Delete = 91

The delete key

§

CapsLock = 92

The Caps Lock Key

§

PageUp = 117

Page Up

§

Pause = 121

Pause Key

§

Menu = 124

Context Menu

§

Home = 125

Home

§

PageDown = 126

Page Down

§

End = 127

End

Trait Implementations§

Source§

impl Clone for Key

Source§

fn clone(&self) -> Key

Returns a duplicate 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 Key

Source§

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

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

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