pub enum KeyCode {
Show 83 variants
Char(char),
Hyper,
Super,
Meta,
Cancel,
Backspace,
Tab,
Clear,
Enter,
Shift,
Escape,
LeftShift,
RightShift,
Control,
LeftControl,
RightControl,
Alt,
LeftAlt,
RightAlt,
Menu,
LeftMenu,
RightMenu,
Pause,
CapsLock,
PageUp,
PageDown,
End,
Home,
LeftArrow,
RightArrow,
UpArrow,
DownArrow,
Select,
Print,
Execute,
PrintScreen,
Insert,
Delete,
Help,
LeftWindows,
RightWindows,
Applications,
Sleep,
Numpad0,
Numpad1,
Numpad2,
Numpad3,
Numpad4,
Numpad5,
Numpad6,
Numpad7,
Numpad8,
Numpad9,
Multiply,
Add,
Separator,
Subtract,
Decimal,
Divide,
Function(u8),
NumLock,
ScrollLock,
Copy,
Cut,
Paste,
BrowserBack,
BrowserForward,
BrowserRefresh,
BrowserStop,
BrowserSearch,
BrowserFavorites,
BrowserHome,
VolumeMute,
VolumeDown,
VolumeUp,
MediaNextTrack,
MediaPrevTrack,
MediaStop,
MediaPlayPause,
ApplicationLeftArrow,
ApplicationRightArrow,
ApplicationUpArrow,
ApplicationDownArrow,
// some variants omitted
}
Expand description
Which key is pressed. Not all of these are probable to appear on most systems. A lot of this list is @wez trawling docs and making an entry for things that might be possible in this first pass.
Variants
Char(char)
The decoded unicode character
Hyper
Super
Meta
Cancel
Ctrl-break on windows
Backspace
Tab
Clear
Enter
Shift
Escape
LeftShift
RightShift
Control
LeftControl
RightControl
Alt
LeftAlt
RightAlt
Menu
LeftMenu
RightMenu
Pause
CapsLock
PageUp
PageDown
End
Home
LeftArrow
RightArrow
UpArrow
DownArrow
Select
Print
Execute
PrintScreen
Insert
Delete
Help
LeftWindows
RightWindows
Applications
Sleep
Numpad0
Numpad1
Numpad2
Numpad3
Numpad4
Numpad5
Numpad6
Numpad7
Numpad8
Numpad9
Multiply
Add
Separator
Subtract
Decimal
Divide
Function(u8)
F1-F24 are possible
NumLock
ScrollLock
Copy
Cut
Paste
BrowserBack
BrowserForward
BrowserRefresh
BrowserStop
BrowserSearch
BrowserFavorites
BrowserHome
VolumeMute
VolumeDown
VolumeUp
MediaNextTrack
MediaPrevTrack
MediaStop
MediaPlayPause
ApplicationLeftArrow
ApplicationRightArrow
ApplicationUpArrow
ApplicationDownArrow
Implementations
sourceimpl KeyCode
impl KeyCode
sourcepub fn normalize_shift_to_upper_case(self, modifiers: Modifiers) -> KeyCode
pub fn normalize_shift_to_upper_case(self, modifiers: Modifiers) -> KeyCode
if SHIFT is held and we have KeyCode::Char(‘c’) we want to normalize
that keycode to KeyCode::Char(‘C’); that is what this function does.
In theory we should give the same treatment to keys like [
-> {
but that assumes something about the keyboard layout and is probably
better done in the gui frontend rather than this layer.
In fact, this function might be better off if it lived elsewhere.
sourcepub fn is_modifier(self) -> bool
pub fn is_modifier(self) -> bool
Return true if the key represents a modifier key.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for KeyCode
impl<'de> Deserialize<'de> for KeyCode
sourcefn 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 Copy for KeyCode
impl Eq for KeyCode
impl StructuralEq for KeyCode
impl StructuralPartialEq for KeyCode
Auto Trait Implementations
impl RefUnwindSafe for KeyCode
impl Send for KeyCode
impl Sync for KeyCode
impl Unpin for KeyCode
impl UnwindSafe for KeyCode
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more