pub struct HidApi { /* private fields */ }
Expand description
Object for handling hidapi context and implementing RAII for it. Only one instance can exist at a time.
Implementations§
Source§impl HidApi
impl HidApi
Sourcepub fn new() -> Result<HidApi, HidError>
pub fn new() -> Result<HidApi, HidError>
Initializes the hidapi.
Will also initialize the currently available device list.
Sourcepub fn refresh_devices(&mut self) -> Result<(), HidError>
pub fn refresh_devices(&mut self) -> Result<(), HidError>
Refresh devices list and information about them (to access them use
device_list()
method)
Sourcepub fn devices(&self) -> &Vec<HidDeviceInfo>
👎Deprecated
pub fn devices(&self) -> &Vec<HidDeviceInfo>
Returns vec of objects containing information about connected devices
Deprecated. Use HidApi::device_list()
instead.
Sourcepub fn device_list(&self) -> impl Iterator<Item = &DeviceInfo>
pub fn device_list(&self) -> impl Iterator<Item = &DeviceInfo>
Returns iterator containing information about attached HID devices.
Sourcepub fn open(&self, vid: u16, pid: u16) -> Result<HidDevice, HidError>
pub fn open(&self, vid: u16, pid: u16) -> Result<HidDevice, HidError>
Open a HID device using a Vendor ID (VID) and Product ID (PID).
When multiple devices with the same vid and pid are available, then the first one found in the internal device list will be used. There are however no guarantees, which device this will be.
Auto Trait Implementations§
impl Freeze for HidApi
impl RefUnwindSafe for HidApi
impl Send for HidApi
impl Sync for HidApi
impl Unpin for HidApi
impl UnwindSafe for HidApi
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more