diff options
Diffstat (limited to 'src/hid.rs')
-rw-r--r-- | src/hid.rs | 32 |
1 files changed, 11 insertions, 21 deletions
@@ -11,30 +11,20 @@ use usb_device::Result; const INTERFACE_CLASS_HID: u8 = 0x03; -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(u8)] -pub enum Subclass { - None = 0x00, - BootInterface = 0x01, -} - -impl From<Subclass> for u8 { - fn from(subclass: Subclass) -> u8 { - subclass as u8 +enum_u8! { + #[derive(Clone, Copy, Debug, PartialEq)] + pub enum Subclass { + None = 0x00, + BootInterface = 0x01, } } -#[derive(Clone, Copy, Debug, PartialEq)] -#[repr(u8)] -pub enum Protocol { - None = 0x00, - Keyboard = 0x01, - Mouse = 0x02, -} - -impl From<Protocol> for u8 { - fn from(protocol: Protocol) -> u8 { - protocol as u8 +enum_u8! { + #[derive(Clone, Copy, Debug, PartialEq)] + pub enum Protocol { + None = 0x00, + Keyboard = 0x01, + Mouse = 0x02, } } |