aboutsummaryrefslogtreecommitdiff
path: root/src/device.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/device.rs')
-rw-r--r--src/device.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/device.rs b/src/device.rs
index 9f3d1a7..7820a80 100644
--- a/src/device.rs
+++ b/src/device.rs
@@ -66,7 +66,7 @@ struct Request {
pub crc: u32,
}
-assert_eq_size!(request; [u8; REPORT_LEN], Request);
+assert_eq_size!([u8; REPORT_LEN], Request);
#[derive(Serialize)]
struct Response {
@@ -79,7 +79,7 @@ struct Response {
pub crc: u32,
}
-assert_eq_size!(response; [u8; REPORT_LEN], Response);
+assert_eq_size!([u8; REPORT_LEN], Response);
impl Response {
fn new(device_status: DeviceStatus, command_id: u8, last_crc: u32) -> Response {
@@ -94,15 +94,15 @@ impl Response {
}
}
-pub struct Nitrokey {
- crc: Crc,
+pub struct Nitrokey<C: Crc> {
+ crc: C,
request: Option<Request>,
request_crc: u32,
buf: [u8; REPORT_LEN],
}
-impl Nitrokey {
- pub fn new(crc: Crc) -> Self {
+impl<C: Crc> Nitrokey<C> {
+ pub fn new(crc: C) -> Self {
Nitrokey {
crc,
request: None,
@@ -112,7 +112,7 @@ impl Nitrokey {
}
}
-impl HidDevice for Nitrokey {
+impl<C: Crc> HidDevice for Nitrokey<C> {
fn subclass(&self) -> Subclass {
Subclass::BootInterface
}