pub enum Key {
}Expand description
A key, by what it is on the US layout.
Variants§
Char(char)
A key typing a printable ASCII character without Shift: a lower
case letter, a digit, punctuation, or ' ' (space).
Enter
Return / Enter (the keypad’s too).
Escape
Escape.
Tab
Tab.
Backspace
Backspace (the Mac’s Delete).
Delete
Forward delete.
Insert
Insert (Help on Apple keyboards).
Up
Up arrow.
Down
Down arrow.
Left
Left arrow.
Right
Right arrow.
Home
Home.
End
End.
PageUp
Page Up.
PageDown
Page Down.
F(u8)
A function key, F1 to F24.
Implementations§
Source§impl Key
impl Key
Sourcepub fn from_virtual_key(vk: u16) -> Option<Key>
pub fn from_virtual_key(vk: u16) -> Option<Key>
The key of Windows virtual-key code vk (VK_*, which the Windows
and GPUI backends get); punctuation by the US layout’s keys.
Sourcepub fn virtual_key(self) -> Option<u16>
pub fn virtual_key(self) -> Option<u16>
The Windows virtual-key code of this key (the main keyboard’s, not the keypad’s): what a key event for it carries.
Sourcepub fn from_hid_usage(usage: u16) -> Option<Key>
pub fn from_hid_usage(usage: u16) -> Option<Key>
The key of USB HID keyboard usage usage (usage page 7, which
UIKit’s UIKey.keyCode is): the key’s place on the US layout,
whatever layout types on it; the keypad’s digits and Enter too.
Sourcepub fn hid_usage(self) -> Option<u16>
pub fn hid_usage(self) -> Option<u16>
The USB HID keyboard usage of this key (the main keyboard’s, not the keypad’s): what a hardware keyboard sends for it.
Sourcepub fn from_android_keycode(code: i32) -> Option<Key>
pub fn from_android_keycode(code: i32) -> Option<Key>
The key of Android key code code (KeyEvent.KEYCODE_*); the
keypad’s digits and Enter, and the D-pad’s center (Enter), too.
Sourcepub fn android_keycode(self) -> Option<i32>
pub fn android_keycode(self) -> Option<i32>
The Android key code of this key (KeyEvent.KEYCODE_*, the main
keyboard’s): what a key event for it carries.