Expand description
Platform-aware keyboard key name handling for Rust applications.
Structs§
- KeyMap
- Ergonomic access to a specific key’s mapping of values
- KeyModifiers
- Bitmask for key modifiers based on the USB HID standard
- Keyboard
State - Keyboard state that helps manage pressed keys, rollover, and generating USB HID reports
Enums§
- KeyMapping
- The mapping of values between platforms for a specific key
- KeyMapping
Code - W3 browser event code for a specific key
- KeyMapping
Id - Id for a specific key
- KeyState
- State of any key, whether it is pressed or not
Constants§
- ALT_STR
- OS’s conventional name for the
Alt modifier. - CTRL_
STR - OS’s conventional name for the
Ctrl modifier. - LOGO_
STR - OS’s conventional name for the logo modifier.
- MODIFIERS_
ORDER - OS’s conventional modifiers order, represented as an ASCII string containing
the characters
csamforCTRL,SHIFT,ALT, andMETA/LOGOrespectively in some order. - NUM_
KEYS - Max keys is 235, but this is the size of array used to manage state
- SHIFT_
STR - OS’s conventional name for the
Shift modifier.
Functions§
- key_
name - Uses the operating system’s API to return a name for the key.
- key_
to_ sc - Converts the OS-independent key mapping code back into an OS-specific scancode. This is not guaranteed to produce the original scancode.
- mods_
prefix_ string - Returns a string representing modifiers using the OS’s conventional names and ordering. For example, on Windows this function might produce “Ctrl + Shift + Alt + Win + “ while on macOS it might produce “Ctrl + Option + Shift
- sc_
to_ key - Converts the OS-specific scancode to an OS-independent key mapping code.
- scancode_
name - Uses the operarting system’s API to return a name for the scancode.