Skip to main content

Key

Enum Key 

Source
#[repr(u8)]
pub enum Key {
Show 110 variants CapsLock = 0, Shift = 1, Control = 2, Alt = 3, Meta = 4, ControlOrMeta = 5, RightShift = 6, RightControl = 7, RightAlt = 8, RightMeta = 9, RightControlOrMeta = 10, Fn = 11, ReturnOrEnter = 12, Escape = 13, DeleteOrBackspace = 14, ForwardDelete = 15, Insert = 16, Tab = 17, Space = 18, Minus = 19, Equal = 20, LeftBracket = 21, RightBracket = 22, Backslash = 23, Semicolon = 24, Quote = 25, Grave = 26, Comma = 27, Period = 28, Slash = 29, UpArrow = 30, RightArrow = 31, DownArrow = 32, LeftArrow = 33, PageUp = 34, PageDown = 35, Home = 36, End = 37, A = 38, B = 39, C = 40, D = 41, E = 42, F = 43, G = 44, H = 45, I = 46, J = 47, K = 48, L = 49, M = 50, N = 51, O = 52, P = 53, Q = 54, R = 55, S = 56, T = 57, U = 58, V = 59, W = 60, X = 61, Y = 62, Z = 63, N0 = 64, N1 = 65, N2 = 66, N3 = 67, N4 = 68, N5 = 69, N6 = 70, N7 = 71, N8 = 72, N9 = 73, Numpad0 = 74, Numpad1 = 75, Numpad2 = 76, Numpad3 = 77, Numpad4 = 78, Numpad5 = 79, Numpad6 = 80, Numpad7 = 81, Numpad8 = 82, Numpad9 = 83, NumpadClear = 84, NumpadEquals = 85, NumpadDivide = 86, NumpadMultiply = 87, NumpadMinus = 88, NumpadPlus = 89, NumpadEnter = 90, NumpadDecimal = 91, F1 = 92, F2 = 93, F3 = 94, F4 = 95, F5 = 96, F6 = 97, F7 = 98, F8 = 99, F9 = 100, F10 = 101, F11 = 102, F12 = 103, FastForward = 104, Rewind = 105, PlayPause = 106, VolumeUp = 107, VolumeDown = 108, Mute = 109,
}
Expand description

A keyboard key used by the KeyboardContext trait.

This implements the Enum trait.

Variants§

§

CapsLock = 0

§

Shift = 1

§

Control = 2

§

Alt = 3

§

Meta = 4

§

ControlOrMeta = 5

§

RightShift = 6

§

RightControl = 7

§

RightAlt = 8

§

RightMeta = 9

§

RightControlOrMeta = 10

§

Fn = 11

§

ReturnOrEnter = 12

§

Escape = 13

§

DeleteOrBackspace = 14

§

ForwardDelete = 15

§

Insert = 16

§

Tab = 17

§

Space = 18

§

Minus = 19

§

Equal = 20

§

LeftBracket = 21

§

RightBracket = 22

§

Backslash = 23

§

Semicolon = 24

§

Quote = 25

§

Grave = 26

§

Comma = 27

§

Period = 28

§

Slash = 29

§

UpArrow = 30

§

RightArrow = 31

§

DownArrow = 32

§

LeftArrow = 33

§

PageUp = 34

§

PageDown = 35

§

Home = 36

§

End = 37

§

A = 38

§

B = 39

§

C = 40

§

D = 41

§

E = 42

§

F = 43

§

G = 44

§

H = 45

§

I = 46

§

J = 47

§

K = 48

§

L = 49

§

M = 50

§

N = 51

§

O = 52

§

P = 53

§

Q = 54

§

R = 55

§

S = 56

§

T = 57

§

U = 58

§

V = 59

§

W = 60

§

X = 61

§

Y = 62

§

Z = 63

§

N0 = 64

§

N1 = 65

§

N2 = 66

§

N3 = 67

§

N4 = 68

§

N5 = 69

§

N6 = 70

§

N7 = 71

§

N8 = 72

§

N9 = 73

§

Numpad0 = 74

§

Numpad1 = 75

§

Numpad2 = 76

§

Numpad3 = 77

§

Numpad4 = 78

§

Numpad5 = 79

§

Numpad6 = 80

§

Numpad7 = 81

§

Numpad8 = 82

§

Numpad9 = 83

§

NumpadClear = 84

§

NumpadEquals = 85

§

NumpadDivide = 86

§

NumpadMultiply = 87

§

NumpadMinus = 88

§

NumpadPlus = 89

§

NumpadEnter = 90

§

NumpadDecimal = 91

§

F1 = 92

§

F2 = 93

§

F3 = 94

§

F4 = 95

§

F5 = 96

§

F6 = 97

§

F7 = 98

§

F8 = 99

§

F9 = 100

§

F10 = 101

§

F11 = 102

§

F12 = 103

§

FastForward = 104

§

Rewind = 105

§

PlayPause = 106

§

VolumeUp = 107

§

VolumeDown = 108

§

Mute = 109

Trait Implementations§

Source§

impl Clone for Key

Source§

fn clone(&self) -> Key

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

Source§

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

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

impl Enum for Key

Source§

const NAME: &'static str = "Key"

The name of the enum.
Source§

const COUNT: u8

The number of variants in the enum.
Source§

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

The display name of this enum variant. Read more
Source§

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

The identifier name of this enum variant. Read more
Source§

fn from_u8(byte: u8) -> Option<Self>

Create an instance of the enum from a u8. Read more
Source§

fn into_u8(self) -> u8

Convert this enum variant to a u8. Read more
Source§

fn iter() -> EnumIterator<Self>

Get an iterator over the variants of the enum.
Source§

impl Eq for Key

Source§

impl PartialEq for Key

Source§

fn eq(&self, other: &Key) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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> 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 = 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.