fn scan_to_code(scan_code: u32) -> Code {
    use Code::*;
    match scan_code {
        0x1 => Escape,
        0x2 => Digit1,
        0x3 => Digit2,
        0x4 => Digit3,
        0x5 => Digit4,
        0x6 => Digit5,
        0x7 => Digit6,
        0x8 => Digit7,
        0x9 => Digit8,
        0xA => Digit9,
        0xB => Digit0,
        0xC => Minus,
        0xD => Equal,
        0xE => Backspace,
        0xF => Tab,
        0x10 => KeyQ,
        0x11 => KeyW,
        0x12 => KeyE,
        0x13 => KeyR,
        0x14 => KeyT,
        0x15 => KeyY,
        0x16 => KeyU,
        0x17 => KeyI,
        0x18 => KeyO,
        0x19 => KeyP,
        0x1A => BracketLeft,
        0x1B => BracketRight,
        0x1C => Enter,
        0x1D => ControlLeft,
        0x1E => KeyA,
        0x1F => KeyS,
        0x20 => KeyD,
        0x21 => KeyF,
        0x22 => KeyG,
        0x23 => KeyH,
        0x24 => KeyJ,
        0x25 => KeyK,
        0x26 => KeyL,
        0x27 => Semicolon,
        0x28 => Quote,
        0x29 => Backquote,
        0x2A => ShiftLeft,
        0x2B => Backslash,
        0x2C => KeyZ,
        0x2D => KeyX,
        0x2E => KeyC,
        0x2F => KeyV,
        0x30 => KeyB,
        0x31 => KeyN,
        0x32 => KeyM,
        0x33 => Comma,
        0x34 => Period,
        0x35 => Slash,
        0x36 => ShiftRight,
        0x37 => NumpadMultiply,
        0x38 => AltLeft,
        0x39 => Space,
        0x3A => CapsLock,
        0x3B => F1,
        0x3C => F2,
        0x3D => F3,
        0x3E => F4,
        0x3F => F5,
        0x40 => F6,
        0x41 => F7,
        0x42 => F8,
        0x43 => F9,
        0x44 => F10,
        0x45 => Pause,
        0x46 => ScrollLock,
        0x47 => Numpad7,
        0x48 => Numpad8,
        0x49 => Numpad9,
        0x4A => NumpadSubtract,
        0x4B => Numpad4,
        0x4C => Numpad5,
        0x4D => Numpad6,
        0x4E => NumpadAdd,
        0x4F => Numpad1,
        0x50 => Numpad2,
        0x51 => Numpad3,
        0x52 => Numpad0,
        0x53 => NumpadDecimal,
        0x54 => PrintScreen,
        0x56 => IntlBackslash,
        0x57 => F11,
        0x58 => F12,
        0x59 => NumpadEqual,
        0x64 => F13,
        0x65 => F14,
        0x66 => F15,
        0x67 => F16,
        0x68 => F17,
        0x69 => F18,
        0x6A => F19,
        0x6B => F20,
        0x6C => F21,
        0x6D => F22,
        0x6E => F23,
        0x70 => KanaMode,
        0x71 => Lang2,
        0x72 => Lang1,
        0x73 => IntlRo,
        0x76 => F24,
        0x77 => Lang4,
        0x78 => Lang3,
        0x79 => Convert,
        0x7B => NonConvert,
        0x7D => IntlYen,
        0x7E => NumpadComma,
        0x108 => Undo,
        0x10A => Paste,
        0x110 => MediaTrackPrevious,
        0x117 => Cut,
        0x118 => Copy,
        0x119 => MediaTrackNext,
        0x11C => NumpadEnter,
        0x11D => ControlRight,
        0x11E => LaunchMail,
        0x120 => AudioVolumeMute,
        0x121 => LaunchApp2,
        0x122 => MediaPlayPause,
        0x124 => MediaStop,
        0x12C => Eject,
        0x12E => AudioVolumeDown,
        0x130 => AudioVolumeUp,
        0x132 => BrowserHome,
        0x135 => NumpadDivide,
        0x137 => PrintScreen,
        0x138 => AltRight,
        0x13B => Help,
        0x145 => NumLock,
        0x146 => Pause,
        0x147 => Home,
        0x148 => ArrowUp,
        0x149 => PageUp,
        0x14B => ArrowLeft,
        0x14D => ArrowRight,
        0x14F => End,
        0x150 => ArrowDown,
        0x151 => PageDown,
        0x152 => Insert,
        0x153 => Delete,
        0x15B => MetaLeft,
        0x15C => MetaRight,
        0x15D => ContextMenu,
        0x15E => Power,
        0x15F => Sleep,
        0x163 => WakeUp,
        0x165 => BrowserSearch,
        0x166 => BrowserFavorites,
        0x167 => BrowserRefresh,
        0x168 => BrowserStop,
        0x169 => BrowserForward,
        0x16A => BrowserBack,
        0x16B => LaunchApp1,
        0x16C => LaunchMail,
        0x16D => MediaSelect,
        0x1F1 => Lang2,
        0x1F2 => Lang1,
        _ => Unidentified,
    }
}
/// Convert scan code to W3C standard code.
///
/// It's hard to get an authoritative source for this; it's mostly based
/// on NativeKeyToDOMCodeName.h in Mozilla.
Convert scan code to W3C standard code.
It's hard to get an authoritative source for this; it's mostly based
on NativeKeyToDOMCodeName.h in Mozilla.
Convert scan code to W3C standard code . It ' s hard to get an authoritative source for this ; it ' s mostly based on NativeKeyToDOMCodeName . h in Mozilla .
fn scan_to_code(scan_code: u32) -> Code {
    use Code::*;
    match scan_code {
        0x1 => Escape,
        0x2 => Digit1,
        0x3 => Digit2,
        0x4 => Digit3,
        0x5 => Digit4,
        0x6 => Digit5,
        0x7 => Digit6,
        0x8 => Digit7,
        0x9 => Digit8,
        0xA => Digit9,
        0xB => Digit0,
        0xC => Minus,
        0xD => Equal,
        0xE => Backspace,
        0xF => Tab,
        0x10 => KeyQ,
        0x11 => KeyW,
        0x12 => KeyE,
        0x13 => KeyR,
        0x14 => KeyT,
        0x15 => KeyY,
        0x16 => KeyU,
        0x17 => KeyI,
        0x18 => KeyO,
        0x19 => KeyP,
        0x1A => BracketLeft,
        0x1B => BracketRight,
        0x1C => Enter,
        0x1D => ControlLeft,
        0x1E => KeyA,
        0x1F => KeyS,
        0x20 => KeyD,
        0x21 => KeyF,
        0x22 => KeyG,
        0x23 => KeyH,
        0x24 => KeyJ,
        0x25 => KeyK,
        0x26 => KeyL,
        0x27 => Semicolon,
        0x28 => Quote,
        0x29 => Backquote,
        0x2A => ShiftLeft,
        0x2B => Backslash,
        0x2C => KeyZ,
        0x2D => KeyX,
        0x2E => KeyC,
        0x2F => KeyV,
        0x30 => KeyB,
        0x31 => KeyN,
        0x32 => KeyM,
        0x33 => Comma,
        0x34 => Period,
        0x35 => Slash,
        0x36 => ShiftRight,
        0x37 => NumpadMultiply,
        0x38 => AltLeft,
        0x39 => Space,
        0x3A => CapsLock,
        0x3B => F1,
        0x3C => F2,
        0x3D => F3,
        0x3E => F4,
        0x3F => F5,
        0x40 => F6,
        0x41 => F7,
        0x42 => F8,
        0x43 => F9,
        0x44 => F10,
        0x45 => Pause,
        0x46 => ScrollLock,
        0x47 => Numpad7,
        0x48 => Numpad8,
        0x49 => Numpad9,
        0x4A => NumpadSubtract,
        0x4B => Numpad4,
        0x4C => Numpad5,
        0x4D => Numpad6,
        0x4E => NumpadAdd,
        0x4F => Numpad1,
        0x50 => Numpad2,
        0x51 => Numpad3,
        0x52 => Numpad0,
        0x53 => NumpadDecimal,
        0x54 => PrintScreen,
        0x56 => IntlBackslash,
        0x57 => F11,
        0x58 => F12,
        0x59 => NumpadEqual,
        0x64 => F13,
        0x65 => F14,
        0x66 => F15,
        0x67 => F16,
        0x68 => F17,
        0x69 => F18,
        0x6A => F19,
        0x6B => F20,
        0x6C => F21,
        0x6D => F22,
        0x6E => F23,
        0x70 => KanaMode,
        0x71 => Lang2,
        0x72 => Lang1,
        0x73 => IntlRo,
        0x76 => F24,
        0x77 => Lang4,
        0x78 => Lang3,
        0x79 => Convert,
        0x7B => NonConvert,
        0x7D => IntlYen,
        0x7E => NumpadComma,
        0x108 => Undo,
        0x10A => Paste,
        0x110 => MediaTrackPrevious,
        0x117 => Cut,
        0x118 => Copy,
        0x119 => MediaTrackNext,
        0x11C => NumpadEnter,
        0x11D => ControlRight,
        0x11E => LaunchMail,
        0x120 => AudioVolumeMute,
        0x121 => LaunchApp2,
        0x122 => MediaPlayPause,
        0x124 => MediaStop,
        0x12C => Eject,
        0x12E => AudioVolumeDown,
        0x130 => AudioVolumeUp,
        0x132 => BrowserHome,
        0x135 => NumpadDivide,
        0x137 => PrintScreen,
        0x138 => AltRight,
        0x13B => Help,
        0x145 => NumLock,
        0x146 => Pause,
        0x147 => Home,
        0x148 => ArrowUp,
        0x149 => PageUp,
        0x14B => ArrowLeft,
        0x14D => ArrowRight,
        0x14F => End,
        0x150 => ArrowDown,
        0x151 => PageDown,
        0x152 => Insert,
        0x153 => Delete,
        0x15B => MetaLeft,
        0x15C => MetaRight,
        0x15D => ContextMenu,
        0x15E => Power,
        0x15F => Sleep,
        0x163 => WakeUp,
        0x165 => BrowserSearch,
        0x166 => BrowserFavorites,
        0x167 => BrowserRefresh,
        0x168 => BrowserStop,
        0x169 => BrowserForward,
        0x16A => BrowserBack,
        0x16B => LaunchApp1,
        0x16C => LaunchMail,
        0x16D => MediaSelect,
        0x1F1 => Lang2,
        0x1F2 => Lang1,
        _ => Unidentified,
    }
}
fn scan_to_code ( scan_code : u32 ) -> Code { use Code :: * ; match scan_code { 0x1 => Escape , 0x2 => Digit1 , 0x3 => Digit2 , 0x4 => Digit3 , 0x5 => Digit4 , 0x6 => Digit5 , 0x7 => Digit6 , 0x8 => Digit7 , 0x9 => Digit8 , 0xA => Digit9 , 0xB => Digit0 , 0xC => Minus , 0xD => Equal , 0xE => Backspace , 0xF => Tab , 0x10 => KeyQ , 0x11 => KeyW , 0x12 => KeyE , 0x13 => KeyR , 0x14 => KeyT , 0x15 => KeyY , 0x16 => KeyU , 0x17 => KeyI , 0x18 => KeyO , 0x19 => KeyP , 0x1A => BracketLeft , 0x1B => BracketRight , 0x1C => Enter , 0x1D => ControlLeft , 0x1E => KeyA , 0x1F => KeyS , 0x20 => KeyD , 0x21 => KeyF , 0x22 => KeyG , 0x23 => KeyH , 0x24 => KeyJ , 0x25 => KeyK , 0x26 => KeyL , 0x27 => Semicolon , 0x28 => Quote , 0x29 => Backquote , 0x2A => ShiftLeft , 0x2B => Backslash , 0x2C => KeyZ , 0x2D => KeyX , 0x2E => KeyC , 0x2F => KeyV , 0x30 => KeyB , 0x31 => KeyN , 0x32 => KeyM , 0x33 => Comma , 0x34 => Period , 0x35 => Slash , 0x36 => ShiftRight , 0x37 => NumpadMultiply , 0x38 => AltLeft , 0x39 => Space , 0x3A => CapsLock , 0x3B => F1 , 0x3C => F2 , 0x3D => F3 , 0x3E => F4 , 0x3F => F5 , 0x40 => F6 , 0x41 => F7 , 0x42 => F8 , 0x43 => F9 , 0x44 => F10 , 0x45 => Pause , 0x46 => ScrollLock , 0x47 => Numpad7 , 0x48 => Numpad8 , 0x49 => Numpad9 , 0x4A => NumpadSubtract , 0x4B => Numpad4 , 0x4C => Numpad5 , 0x4D => Numpad6 , 0x4E => NumpadAdd , 0x4F => Numpad1 , 0x50 => Numpad2 , 0x51 => Numpad3 , 0x52 => Numpad0 , 0x53 => NumpadDecimal , 0x54 => PrintScreen , 0x56 => IntlBackslash , 0x57 => F11 , 0x58 => F12 , 0x59 => NumpadEqual , 0x64 => F13 , 0x65 => F14 , 0x66 => F15 , 0x67 => F16 , 0x68 => F17 , 0x69 => F18 , 0x6A => F19 , 0x6B => F20 , 0x6C => F21 , 0x6D => F22 , 0x6E => F23 , 0x70 => KanaMode , 0x71 => Lang2 , 0x72 => Lang1 , 0x73 => IntlRo , 0x76 => F24 , 0x77 => Lang4 , 0x78 => Lang3 , 0x79 => Convert , 0x7B => NonConvert , 0x7D => IntlYen , 0x7E => NumpadComma , 0x108 => Undo , 0x10A => Paste , 0x110 => MediaTrackPrevious , 0x117 => Cut , 0x118 => Copy , 0x119 => MediaTrackNext , 0x11C => NumpadEnter , 0x11D => ControlRight , 0x11E => LaunchMail , 0x120 => AudioVolumeMute , 0x121 => LaunchApp2 , 0x122 => MediaPlayPause , 0x124 => MediaStop , 0x12C => Eject , 0x12E => AudioVolumeDown , 0x130 => AudioVolumeUp , 0x132 => BrowserHome , 0x135 => NumpadDivide , 0x137 => PrintScreen , 0x138 => AltRight , 0x13B => Help , 0x145 => NumLock , 0x146 => Pause , 0x147 => Home , 0x148 => ArrowUp , 0x149 => PageUp , 0x14B => ArrowLeft , 0x14D => ArrowRight , 0x14F => End , 0x150 => ArrowDown , 0x151 => PageDown , 0x152 => Insert , 0x153 => Delete , 0x15B => MetaLeft , 0x15C => MetaRight , 0x15D => ContextMenu , 0x15E => Power , 0x15F => Sleep , 0x163 => WakeUp , 0x165 => BrowserSearch , 0x166 => BrowserFavorites , 0x167 => BrowserRefresh , 0x168 => BrowserStop , 0x169 => BrowserForward , 0x16A => BrowserBack , 0x16B => LaunchApp1 , 0x16C => LaunchMail , 0x16D => MediaSelect , 0x1F1 => Lang2 , 0x1F2 => Lang1 , _ => Unidentified , } }
Convert scan code to W3C standard code.
Convert scan code to W3C standard code .
scan_code
u32
scan_code
u32