Created
August 20, 2018 12:33
-
-
Save Geobert/05d3ae9e474642ba27bdd55aa009180f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub struct UsbContext { | |
api: hidapi::HidApi, | |
} | |
impl UsbContext { | |
pub fn new() -> UsbContext { | |
UsbContext { | |
api: hidapi::HidApi::new().unwrap() | |
} | |
} | |
} | |
fn this_works() { | |
{ | |
let usb = UsbContext::new(); | |
// my code to switch mode | |
} | |
let usb = UsbContext::new(); | |
// code to send msg | |
} | |
fn this_fails() { | |
let usb = UsbContext::new(); | |
// my code to switch mode | |
// code to send msg | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment