Skip to main content

Key

Enum Key 

Source
pub enum Key {
Show 89 variants A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, Digit0, Digit1, Digit2, Digit3, Digit4, Digit5, Digit6, Digit7, Digit8, Digit9, Semicolon, Up, Down, Left, Right, Enter, Escape, Space, Tab, Backspace, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, Comma, Period, Slash, Apostrophe, LeftBracket, RightBracket, Backslash, Minus, Equal, Backquote, Insert, Delete, Home, End, PageUp, PageDown, Kp0, Kp1, Kp2, Kp3, Kp4, Kp5, Kp6, Kp7, Kp8, Kp9, KpAdd, KpSubtract, KpMultiply, KpDivide, KpDecimal,
}
Expand description

A hardware-agnostic keyboard key. app translates platform key codes to these; anything without a variant is ignored.

Variants§

§

A

The a key.

§

B

The b key.

§

C

The c key.

§

D

The d key.

§

E

The e key.

§

F

The f key.

§

G

The g key.

§

H

The h key.

§

I

The i key.

§

J

The j key.

§

K

The k key.

§

L

The l key.

§

M

The m key.

§

N

The n key.

§

O

The o key.

§

P

The p key.

§

Q

The q key.

§

R

The r key.

§

S

The s key.

§

T

The t key.

§

U

The u key.

§

V

The v key.

§

W

The w key.

§

X

The x key.

§

Y

The y key.

§

Z

The z key.

§

Digit0

The 0 key.

§

Digit1

The 1 key.

§

Digit2

The 2 key.

§

Digit3

The 3 key.

§

Digit4

The 4 key.

§

Digit5

The 5 key.

§

Digit6

The 6 key.

§

Digit7

The 7 key.

§

Digit8

The 8 key.

§

Digit9

The 9 key.

§

Semicolon

The ; key.

§

Up

The Up key.

§

Down

The Down key.

§

Left

The Left key.

§

Right

The Right key.

§

Enter

The Enter key.

§

Escape

The Escape key.

§

Space

The Space key.

§

Tab

The Tab key.

§

Backspace

The Backspace key.

§

F1

The F1 key.

§

F2

The F2 key.

§

F3

The F3 key.

§

F4

The F4 key.

§

F5

The F5 key.

§

F6

The F6 key.

§

F7

The F7 key.

§

F8

The F8 key.

§

F9

The F9 key.

§

F10

The F10 key.

§

F11

The F11 key.

§

F12

The F12 key.

§

Comma

The , key.

§

Period

The . key.

§

Slash

The / key.

§

Apostrophe

The ' key.

§

LeftBracket

The [ key.

§

RightBracket

The ] key.

§

Backslash

The \ key.

§

Minus

The - key.

§

Equal

The = key.

§

Backquote

The ` key.

§

Insert

The Insert key.

§

Delete

The Delete key.

§

Home

The Home key.

§

End

The End key.

§

PageUp

The PageUp key.

§

PageDown

The PageDown key.

§

Kp0

The Kp0 key.

§

Kp1

The Kp1 key.

§

Kp2

The Kp2 key.

§

Kp3

The Kp3 key.

§

Kp4

The Kp4 key.

§

Kp5

The Kp5 key.

§

Kp6

The Kp6 key.

§

Kp7

The Kp7 key.

§

Kp8

The Kp8 key.

§

Kp9

The Kp9 key.

§

KpAdd

The Kp+ key.

§

KpSubtract

The Kp- key.

§

KpMultiply

The Kp* key.

§

KpDivide

The Kp/ key.

§

KpDecimal

The Kp. key.

Implementations§

Source§

impl Key

Source

pub const ALL: &'static [Key]

Every key, in declaration order.

Source

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

The name used in keymap files: lowercase letters (h), digits (0), punctuation as itself (;, ,, \), numpad keys prefixed Kp (Kp0, Kp+), and capitalised names for the rest (Left, F12).

Source§

impl Key

Source

pub fn from_name(name: &str) -> Option<Self>

Looks a key up by its name (exact match).

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<'de> Deserialize<'de> for Key

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

Source§

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

impl PartialEq for Key

Source§

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

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 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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.