pub enum KeyInput {
}Expand description
Framework-agnostic key input representation.
Consumers map their framework’s events to this type. For example:
- crossterm:
KeyEvent→KeyInput - winit:
KeyEvent→KeyInput - egui:
Key→KeyInput
§Keyboard Layout Considerations
When using Shift(char), be aware that keyboard layouts vary:
- US:
Shift+'n'produces'N' - German:
Shift+'7'produces'/'
For cross-layout compatibility, prefer:
- Function keys (
F1-F12) for important actions - Ctrl/Alt modifiers with navigation keys
- Unshifted character keys for common actions
Variants§
Char(char)
A character key was pressed
Up
Up arrow key
Down
Down arrow key
Left
Left arrow key
Right
Right arrow key
Home
Home key
End
End key
PageUp
Page Up key
PageDown
Page Down key
Enter
Enter/Return key
Backspace
Backspace key
Delete
Delete key
Escape
Escape key
Tab
Tab key
F(u8)
Function key (F1-F12)
Ctrl(char)
Ctrl + character
Alt(char)
Alt + character
Shift(char)
Shift + character (for uppercase letters)
CtrlUp
Ctrl + Up arrow
CtrlDown
Ctrl + Down arrow
CtrlLeft
Ctrl + Left arrow
CtrlRight
Ctrl + Right arrow
CtrlHome
Ctrl + Home
CtrlEnd
Ctrl + End
AltUp
Alt + Up arrow
AltDown
Alt + Down arrow
AltEnter
Alt + Enter
ShiftUp
Shift + Up arrow
ShiftDown
Shift + Down arrow
Implementations§
Trait Implementations§
impl Eq for KeyInput
impl StructuralPartialEq for KeyInput
Auto Trait Implementations§
impl Freeze for KeyInput
impl RefUnwindSafe for KeyInput
impl Send for KeyInput
impl Sync for KeyInput
impl Unpin for KeyInput
impl UnwindSafe for KeyInput
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,
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.