pub enum InputKey {
Show 59 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,
Num0,
Num1,
Num2,
Num3,
Num4,
Num5,
Num6,
Num7,
Num8,
Num9,
Space,
Tab,
Enter,
Backspace,
Delete,
Shift,
Control,
Alt,
Up,
Down,
Left,
Right,
Minus,
Equals,
LeftBracket,
RightBracket,
Backslash,
Semicolon,
Quote,
Comma,
Period,
Slash,
Backtick,
}Expand description
A canonical, backend-agnostic keyboard key.
Each rendering backend maps its native key codes (macOS NSEvent key codes, Windows virtual keys, GLFW keys) to and from this enum, so a key binding can be stored and shown the same way everywhere. Unit variants serialize to their name, so a persisted binding survives a build.
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
Num0
Num1
Num2
Num3
Num4
Num5
Num6
Num7
Num8
Num9
Space
Tab
Enter
Backspace
Delete
Shift
Control
Alt
Up
Down
Left
Right
Minus
Equals
LeftBracket
RightBracket
Backslash
Semicolon
Quote
Comma
Period
Slash
Backtick
Implementations§
Source§impl InputKey
impl InputKey
Sourcepub fn name(self) -> &'static str
pub fn name(self) -> &'static str
The canonical variant name, matching the serialized form and how
a KeyBinding stores its key (e.g. "W",
"Space", "Enter", "Control"). Unlike
display_name this is the exact
enum-variant spelling, so it round-trips with serde.
Sourcepub fn display_name(self) -> &'static str
pub fn display_name(self) -> &'static str
A short label for the settings menu (e.g. "W", "Space",
"Ctrl"). Defaults to name unless the key
declared a shorter one.
Trait Implementations§
impl Copy for InputKey
Source§impl<'de> Deserialize<'de> for InputKey
impl<'de> Deserialize<'de> for InputKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for InputKey
impl StructuralPartialEq for InputKey
Auto Trait Implementations§
impl Freeze for InputKey
impl RefUnwindSafe for InputKey
impl Send for InputKey
impl Sync for InputKey
impl Unpin for InputKey
impl UnsafeUnpin for InputKey
impl UnwindSafe for InputKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.