Created
December 20, 2015 16:30
-
-
Save awelkie/88f6267b89ea998f3bb3 to your computer and use it in GitHub Desktop.
PhantomRef
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
[package] | |
name = "usb_example" | |
version = "0.1.0" | |
authors = ["Allen Welkie <allen.welkie@gmail.com>"] | |
[dependencies] | |
libusb = "*" |
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
extern crate libusb; | |
struct Combined<'a> { | |
ctx: libusb::Context, | |
dev: libusb::Device<'a>, | |
} | |
fn get_device<'a>() -> Combined<'a> { | |
let mut ctx = libusb::Context::new().unwrap(); | |
let dev = ctx.devices().unwrap().iter().next().unwrap(); | |
Combined { ctx: ctx, dev: dev, } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment