Skip to main content

Key

Enum Key 

Source
#[repr(u8)]
pub enum Key {
Show 56 variants Grave = 0, Num1 = 1, Num2 = 2, Num3 = 3, Num4 = 4, Num5 = 5, Num6 = 6, Num7 = 7, Num8 = 8, Num9 = 9, Num0 = 10, Minus = 11, Equal = 12, Backspace = 13, Tab = 14, Q = 15, W = 16, E = 17, R = 18, T = 19, Y = 20, U = 21, I = 22, O = 23, P = 24, LeftBracket = 25, RightBracket = 26, Backslash = 27, Fn = 28, Shift = 29, A = 30, S = 31, D = 32, F = 33, G = 34, H = 35, J = 36, K = 37, L = 38, Semicolon = 39, Quote = 40, Enter = 41, Ctrl = 42, Opt = 43, Alt = 44, Z = 45, X = 46, C = 47, V = 48, B = 49, N = 50, M = 51, Comma = 52, Period = 53, Slash = 54, Space = 55,
}
Expand description

A physical key, named after its primary legend.

The discriminants are dense (0..Key::COUNT) so a set of held keys fits in one u64.

Variants§

§

Grave = 0

§

Num1 = 1

§

Num2 = 2

§

Num3 = 3

§

Num4 = 4

§

Num5 = 5

§

Num6 = 6

§

Num7 = 7

§

Num8 = 8

§

Num9 = 9

§

Num0 = 10

§

Minus = 11

§

Equal = 12

§

Backspace = 13

§

Tab = 14

§

Q = 15

§

W = 16

§

E = 17

§

R = 18

§

T = 19

§

Y = 20

§

U = 21

§

I = 22

§

O = 23

§

P = 24

§

LeftBracket = 25

§

RightBracket = 26

§

Backslash = 27

§

Fn = 28

§

Shift = 29

§

A = 30

§

S = 31

§

D = 32

§

F = 33

§

G = 34

§

H = 35

§

J = 36

§

K = 37

§

L = 38

§

Semicolon = 39

§

Quote = 40

§

Enter = 41

§

Ctrl = 42

§

Opt = 43

§

Alt = 44

§

Z = 45

§

X = 46

§

C = 47

§

V = 48

§

B = 49

§

N = 50

§

M = 51

§

Comma = 52

§

Period = 53

§

Slash = 54

§

Space = 55

Implementations§

Source§

impl Key

Source

pub const COUNT: usize

Number of keys.

Source

pub const fn legend(self) -> Option<(char, char)>

Unshifted and shifted characters printed on the key, for keys that type a character.

Source

pub const fn modifier(self) -> Option<Modifiers>

The modifier this key holds down, if it is a modifier key.

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

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

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
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§

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

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable)§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable)§

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

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

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

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

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

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

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

Source§

impl Eq for Key

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§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.