MCPcopy Index your code
hub / github.com/TyberiusPrime/KeyToKey / hex_digit_to_keycode

Function hex_digit_to_keycode

src/lib.rs:250–272  ·  view source on GitHub ↗

transform hex digits to USB keycodes used by the unicode senders

(digit: char)

Source from the content-addressed store, hash-verified

248/// transform hex digits to USB keycodes
249/// used by the unicode senders
250fn hex_digit_to_keycode(digit: char) -> KeyCode {
251 //todo which way it's shorter in machine code this or
252 //with the derived nums...
253 match digit {
254 '0' => KeyCode::Kb0,
255 '1' => KeyCode::Kb1,
256 '2' => KeyCode::Kb2,
257 '3' => KeyCode::Kb3,
258 '4' => KeyCode::Kb4,
259 '5' => KeyCode::Kb5,
260 '6' => KeyCode::Kb6,
261 '7' => KeyCode::Kb7,
262 '8' => KeyCode::Kb8,
263 '9' => KeyCode::Kb9,
264 'A' | 'a' => KeyCode::A,
265 'B' | 'b' => KeyCode::B,
266 'C' | 'c' => KeyCode::C,
267 'D' | 'd' => KeyCode::D,
268 'E' | 'e' => KeyCode::E,
269 'F' | 'f' => KeyCode::F,
270 _ => panic!("Passed more than one digit to hex_digit_to_keycode"),
271 }
272}
273fn hex_digit_to_keycode_dvorak(digit: char) -> KeyCode {
274 //todo which way it's shorter in machine code this or
275 //with the derived nums...

Callers 1

send_unicodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected