aboutsummaryrefslogtreecommitdiff
path: root/src/hid.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/hid.rs')
-rw-r--r--src/hid.rs32
1 files changed, 11 insertions, 21 deletions
diff --git a/src/hid.rs b/src/hid.rs
index 4f1d506..6274e7f 100644
--- a/src/hid.rs
+++ b/src/hid.rs
@@ -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,
}
}