Skip to main content

Key

Enum Key 

Source
#[repr(u8)]
pub enum Key {
Show 98 variants A = 0, B = 1, C = 2, D = 3, E = 4, F = 5, G = 6, H = 7, I = 8, J = 9, K = 10, L = 11, M = 12, N = 13, O = 14, P = 15, Q = 16, R = 17, S = 18, T = 19, U = 20, V = 21, W = 22, X = 23, Y = 24, Z = 25, Digit0 = 26, Digit1 = 27, Digit2 = 28, Digit3 = 29, Digit4 = 30, Digit5 = 31, Digit6 = 32, Digit7 = 33, Digit8 = 34, Digit9 = 35, Left = 36, Right = 37, Up = 38, Down = 39, Space = 40, Enter = 41, Escape = 42, Tab = 43, Backspace = 44, LeftShift = 45, RightShift = 46, LeftControl = 47, RightControl = 48, LeftAlt = 49, RightAlt = 50, F1 = 51, F2 = 52, F3 = 53, F4 = 54, F5 = 55, F6 = 56, F7 = 57, F8 = 58, F9 = 59, F10 = 60, F11 = 61, F12 = 62, Minus = 63, Equal = 64, BracketLeft = 65, BracketRight = 66, Semicolon = 67, Quote = 68, Backquote = 69, Backslash = 70, Comma = 71, Period = 72, Slash = 73, Home = 74, End = 75, PageUp = 76, PageDown = 77, Insert = 78, Delete = 79, CapsLock = 80, Numpad0 = 81, Numpad1 = 82, Numpad2 = 83, Numpad3 = 84, Numpad4 = 85, Numpad5 = 86, Numpad6 = 87, Numpad7 = 88, Numpad8 = 89, Numpad9 = 90, NumpadAdd = 91, NumpadSubtract = 92, NumpadMultiply = 93, NumpadDivide = 94, NumpadDecimal = 95, NumpadEnter = 96, NumLock = 97,
}
Expand description

A key by physical position, independent of the layout in use: Key::W is the key at the W position on a US keyboard.

Text entry belongs to the UI layer, not here. A key is also a button vocabulary of its own, which is what a prototype binds through before it declares its actions.

Variants§

§

A = 0

The A key position.

§

B = 1

The B key position.

§

C = 2

The C key position.

§

D = 3

The D key position.

§

E = 4

The E key position.

§

F = 5

The F key position.

§

G = 6

The G key position.

§

H = 7

The H key position.

§

I = 8

The I key position.

§

J = 9

The J key position.

§

K = 10

The K key position.

§

L = 11

The L key position.

§

M = 12

The M key position.

§

N = 13

The N key position.

§

O = 14

The O key position.

§

P = 15

The P key position.

§

Q = 16

The Q key position.

§

R = 17

The R key position.

§

S = 18

The S key position.

§

T = 19

The T key position.

§

U = 20

The U key position.

§

V = 21

The V key position.

§

W = 22

The W key position.

§

X = 23

The X key position.

§

Y = 24

The Y key position.

§

Z = 25

The Z key position.

§

Digit0 = 26

The Digit0 key position.

§

Digit1 = 27

The Digit1 key position.

§

Digit2 = 28

The Digit2 key position.

§

Digit3 = 29

The Digit3 key position.

§

Digit4 = 30

The Digit4 key position.

§

Digit5 = 31

The Digit5 key position.

§

Digit6 = 32

The Digit6 key position.

§

Digit7 = 33

The Digit7 key position.

§

Digit8 = 34

The Digit8 key position.

§

Digit9 = 35

The Digit9 key position.

§

Left = 36

The Left key position.

§

Right = 37

The Right key position.

§

Up = 38

The Up key position.

§

Down = 39

The Down key position.

§

Space = 40

The Space key position.

§

Enter = 41

The Enter key position.

§

Escape = 42

The Escape key position.

§

Tab = 43

The Tab key position.

§

Backspace = 44

The Backspace key position.

§

LeftShift = 45

The LeftShift key position.

§

RightShift = 46

The RightShift key position.

§

LeftControl = 47

The LeftControl key position.

§

RightControl = 48

The RightControl key position.

§

LeftAlt = 49

The LeftAlt key position.

§

RightAlt = 50

The RightAlt key position.

§

F1 = 51

The F1 key position.

§

F2 = 52

The F2 key position.

§

F3 = 53

The F3 key position.

§

F4 = 54

The F4 key position.

§

F5 = 55

The F5 key position.

§

F6 = 56

The F6 key position.

§

F7 = 57

The F7 key position.

§

F8 = 58

The F8 key position.

§

F9 = 59

The F9 key position.

§

F10 = 60

The F10 key position.

§

F11 = 61

The F11 key position.

§

F12 = 62

The F12 key position.

§

Minus = 63

The Minus key position.

§

Equal = 64

The Equal key position.

§

BracketLeft = 65

The BracketLeft key position.

§

BracketRight = 66

The BracketRight key position.

§

Semicolon = 67

The Semicolon key position.

§

Quote = 68

The Quote key position.

§

Backquote = 69

The Backquote key position.

§

Backslash = 70

The Backslash key position.

§

Comma = 71

The Comma key position.

§

Period = 72

The Period key position.

§

Slash = 73

The Slash key position.

§

Home = 74

The Home key position.

§

End = 75

The End key position.

§

PageUp = 76

The PageUp key position.

§

PageDown = 77

The PageDown key position.

§

Insert = 78

The Insert key position.

§

Delete = 79

The Delete key position.

§

CapsLock = 80

The CapsLock key position.

§

Numpad0 = 81

The Numpad0 key position.

§

Numpad1 = 82

The Numpad1 key position.

§

Numpad2 = 83

The Numpad2 key position.

§

Numpad3 = 84

The Numpad3 key position.

§

Numpad4 = 85

The Numpad4 key position.

§

Numpad5 = 86

The Numpad5 key position.

§

Numpad6 = 87

The Numpad6 key position.

§

Numpad7 = 88

The Numpad7 key position.

§

Numpad8 = 89

The Numpad8 key position.

§

Numpad9 = 90

The Numpad9 key position.

§

NumpadAdd = 91

The NumpadAdd key position.

§

NumpadSubtract = 92

The NumpadSubtract key position.

§

NumpadMultiply = 93

The NumpadMultiply key position.

§

NumpadDivide = 94

The NumpadDivide key position.

§

NumpadDecimal = 95

The NumpadDecimal key position.

§

NumpadEnter = 96

The NumpadEnter key position.

§

NumLock = 97

The NumLock key position.

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 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 From<Key> for ButtonBinding

Source§

fn from(key: Key) -> Self

Converts to this type from the input type.
Source§

impl From<Key> for Switch

Source§

fn from(key: Key) -> Self

Converts to this type from the input type.
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 InputAction for Key

Source§

type Binding = ButtonBinding

Binding type for an action of this kind, which is what makes a mis-kinded rebind fail to compile.
Source§

fn defaults(&self) -> Vec<ButtonBinding>

Default controls this action is bound to, before a player changes anything.
Source§

fn all() -> Vec<Self>

Every action of this vocabulary, which startup materializes into the table a player rebinds; one this leaves out reads through nothing.
Source§

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

Name this action is known by in code; also the name the store keeps a rebind under.
Source§

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

The action of this name, or None where the vocabulary has none.
Source§

impl InputActions for Key

Source§

type Button = Key

The vocabulary whose actions read back as held or not.
Source§

type Axis = NoInputAxes

The vocabulary whose actions read back a number.
Source§

type Axis2 = NoInputAxes2

The vocabulary whose actions read back a vector.
Source§

impl InputButtonAction for Key

A key is its own action, bound to itself: the vocabulary a prototype reads through before it has declared what the player does.

Source§

fn bindings(&self) -> Vec<ButtonBinding>

The controls this action starts out bound to; they are alternatives, and any one of them holds it down.
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 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> AsId for T
where T: Hash + Debug,

Source§

impl<T> AsIdSalt for T
where T: Hash + Debug,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

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

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<S> Seats<<S as InputActions>::Axis2, Axis2Binding> for S
where S: InputActions,

Source§

impl<S> Seats<<S as InputActions>::Axis, AxisBinding> for S
where S: InputActions,

Source§

impl<S> Seats<<S as InputActions>::Button, ButtonBinding> for S
where S: InputActions,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

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

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more