fix: Replaced match with HashMap for faster evdevmapping#5
fix: Replaced match with HashMap for faster evdevmapping#5lavafroth merged 4 commits intowaycrate:masterfrom
Conversation
Added lazy_static to Cargo.toml 1. Optimized evdev mapping insertion times with HashMap 2. Loaded the mapping lazily
|
Hi, could we use phf for this? It would build the lookup table at compile time, which is especially useful for us since we already know all the keys in the map.
Perhaps check out https://docs.rs/phf
|
Ah yes that makes sense, I'll take a look at it and modify the PR then |
Removed lazy_static from Cargo.toml. Added phf and phf macros to Cargo.toml 1. Replaced `HashMap` with `phf::Map` for loading the static evdev mapping at compile time
I have made the requested changes, the API was quite simple to work with. Also I didnt add function keys till 24 (so f1-f12) since the test was passing without them, is this fine? |
Never mind, I still have added all the previous keymaps that existed to not cause any trouble in the future. |
|
Thank you for contributing! |
Solves #4
Added lazy_static to Cargo.toml
Tested the above changes with:
cargo test