MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / hid_for_character

Function hid_for_character

packages/server/src/main.rs:5825–5878  ·  view source on GitHub ↗
(character: char)

Source from the content-addressed store, hash-verified

5823}
5824
5825fn hid_for_character(character: char) -> Option<(u16, u32)> {
5826 let shift: u32 = 1;
5827 let mapping = match character {
5828 'a'..='z' => (character as u16 - b'a' as u16 + 4, 0),
5829 'A'..='Z' => (character as u16 - b'A' as u16 + 4, shift),
5830 '1' => (30, 0),
5831 '!' => (30, shift),
5832 '2' => (31, 0),
5833 '@' => (31, shift),
5834 '3' => (32, 0),
5835 '#' => (32, shift),
5836 '4' => (33, 0),
5837 '$' => (33, shift),
5838 '5' => (34, 0),
5839 '%' => (34, shift),
5840 '6' => (35, 0),
5841 '^' => (35, shift),
5842 '7' => (36, 0),
5843 '&' => (36, shift),
5844 '8' => (37, 0),
5845 '*' => (37, shift),
5846 '9' => (38, 0),
5847 '(' => (38, shift),
5848 '0' => (39, 0),
5849 ')' => (39, shift),
5850 '\n' | '\r' => (40, 0),
5851 '\t' => (43, 0),
5852 ' ' => (44, 0),
5853 '-' => (45, 0),
5854 '_' => (45, shift),
5855 '=' => (46, 0),
5856 '+' => (46, shift),
5857 '[' => (47, 0),
5858 '{' => (47, shift),
5859 ']' => (48, 0),
5860 '}' => (48, shift),
5861 '\\' => (49, 0),
5862 '|' => (49, shift),
5863 ';' => (51, 0),
5864 ':' => (51, shift),
5865 '\'' => (52, 0),
5866 '"' => (52, shift),
5867 '`' => (53, 0),
5868 '~' => (53, shift),
5869 ',' => (54, 0),
5870 '<' => (54, shift),
5871 '.' => (55, 0),
5872 '>' => (55, shift),
5873 '/' => (56, 0),
5874 '?' => (56, shift),
5875 _ => return None,
5876 };
5877 Some(mapping)
5878}
5879
5880#[allow(clippy::too_many_arguments)]
5881async fn serve(

Callers 1

type_textFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected