Trait rusb::UsbContext [−][src]
pub trait UsbContext: Clone + Sized + Send + Sync { fn as_raw(&self) -> *mut libusb_context; fn devices(&self) -> Result<DeviceList<Self>> { ... } fn open_device_with_vid_pid(
&self,
vendor_id: u16,
product_id: u16
) -> Option<DeviceHandle<Self>> { ... } fn set_log_level(&mut self, level: LogLevel) { ... } fn register_callback(
&self,
vendor_id: Option<u16>,
product_id: Option<u16>,
class: Option<u8>,
callback: Box<dyn Hotplug<Self>>
) -> Result<Registration<Self>> { ... } fn unregister_callback(&self, _reg: Registration<Self>) { ... } fn handle_events(&self, timeout: Option<Duration>) -> Result<()> { ... } }
Required methods
fn as_raw(&self) -> *mut libusb_context
[src]
fn as_raw(&self) -> *mut libusb_context
[src]Get the raw libusb_context pointer, for advanced use in unsafe code.
Provided methods
fn devices(&self) -> Result<DeviceList<Self>>
[src]
fn devices(&self) -> Result<DeviceList<Self>>
[src]Returns a list of the current USB devices.
fn open_device_with_vid_pid(
&self,
vendor_id: u16,
product_id: u16
) -> Option<DeviceHandle<Self>>
[src]
fn open_device_with_vid_pid(
&self,
vendor_id: u16,
product_id: u16
) -> Option<DeviceHandle<Self>>
[src]Convenience function to open a device by its vendor ID and product ID.
This function is provided as a convenience for building prototypes without having to
iterate a DeviceList
. It is not meant for production
applications.
Returns a device handle for the first device found matching vendor_id
and product_id
.
On error, or if the device could not be found, it returns None
.
fn set_log_level(&mut self, level: LogLevel)
[src]
fn set_log_level(&mut self, level: LogLevel)
[src]Sets the log level of a libusb
for context.
fn register_callback(
&self,
vendor_id: Option<u16>,
product_id: Option<u16>,
class: Option<u8>,
callback: Box<dyn Hotplug<Self>>
) -> Result<Registration<Self>>
[src]
&self,
vendor_id: Option<u16>,
product_id: Option<u16>,
class: Option<u8>,
callback: Box<dyn Hotplug<Self>>
) -> Result<Registration<Self>>
fn unregister_callback(&self, _reg: Registration<Self>)
[src]
fn handle_events(&self, timeout: Option<Duration>) -> Result<()>
[src]
Implementors
impl UsbContext for Context
[src]
impl UsbContext for Context
[src]fn as_raw(&self) -> *mut libusb_context
[src]
impl UsbContext for GlobalContext
[src]
impl UsbContext for GlobalContext
[src]