Crate key_mapping
source ·Expand description
key-mapping library allows for keyboard key code conversion between systems such as the DOM and
HID usage-ids. With Rust [no_std]
support.
§Features
Extra functionality is behind optional features to optimize compile time and binary size.
std
(enabled by default) - Add support for Rust’s libstd types.serde
Add support forserde
de/serializing library.usbd-hid
Add support for converting between the usbd-hid library KeyboardReport.
§Example Usage
[dependencies]
key-mapping = "0.4"
use key_mapping::Keyboard;
fn main() {
let dom_code = "KeyA";
let usage_id = Keyboard::US.dom_key_to_usage_id(dom_code).unwrap();
assert_eq!(0x04, *usage_id);
}
RunStructs§
- A keyboard action, could be used for making key press/release events, Defaults to no keys or modifiers.
- A single mapped keyboard key.
Enums§
- Keyboard layouts, used to convert between key-code types.
- Keyboard keys as enum values, with usage-id representation.
Constants§
Statics§
- DOM key to usage-id map for the UK layout.
- DOM key to usage-id map for the US layout.
- usage-id to mapped key info.