Skip to content

Instantly share code, notes, and snippets.

pub struct OpenRadioContext<'a> { // public struct
usb_context: Context, // private fields, safety depends on these not being accessed directly
device_handle: DeviceHandle<'a>,
}
... snip ...
impl <'a> OpenRadioContext<'a> {
fn open() -> OpenRadioContext<'a> {
pub struct OpenRadioContext<'a, 'b:'a> {
_context: PhantomData<&'b Context>,
usb_context: Box<Context>,
device_handle: DeviceHandle<'a>,
}
impl <'a, 'b> Drop for OpenRadioContext<'a, 'b> {
fn drop(&mut self) {
self.device_handle.release_interface(0).unwrap();
}