pub struct Device<'a> { /* private fields */ }
Expand description
The HID device.
Implementations§
Source§impl<'a> Device<'a>
impl<'a> Device<'a>
Sourcepub fn path(&self) -> &Path
pub fn path(&self) -> &Path
The path representation.
Examples found in repository?
examples/list.rs (line 7)
3fn main() {
4 let hid = hid::init().unwrap();
5
6 for device in hid.devices() {
7 print!("{} ", device.path().to_str().unwrap());
8 print!("ID {:x}:{:x} ", device.vendor_id(), device.product_id());
9
10 if let Some(name) = device.manufacturer_string() {
11 print!("{} ", name);
12 }
13
14 if let Some(name) = device.product_string() {
15 print!("{} ", name);
16 }
17
18 if let Some(name) = device.serial_number() {
19 print!("{} ", name);
20 }
21
22 println!();
23 }
24}
Sourcepub fn vendor_id(&self) -> u16
pub fn vendor_id(&self) -> u16
The vendor ID.
Examples found in repository?
examples/list.rs (line 8)
3fn main() {
4 let hid = hid::init().unwrap();
5
6 for device in hid.devices() {
7 print!("{} ", device.path().to_str().unwrap());
8 print!("ID {:x}:{:x} ", device.vendor_id(), device.product_id());
9
10 if let Some(name) = device.manufacturer_string() {
11 print!("{} ", name);
12 }
13
14 if let Some(name) = device.product_string() {
15 print!("{} ", name);
16 }
17
18 if let Some(name) = device.serial_number() {
19 print!("{} ", name);
20 }
21
22 println!();
23 }
24}
Sourcepub fn product_id(&self) -> u16
pub fn product_id(&self) -> u16
The product ID.
Examples found in repository?
examples/list.rs (line 8)
3fn main() {
4 let hid = hid::init().unwrap();
5
6 for device in hid.devices() {
7 print!("{} ", device.path().to_str().unwrap());
8 print!("ID {:x}:{:x} ", device.vendor_id(), device.product_id());
9
10 if let Some(name) = device.manufacturer_string() {
11 print!("{} ", name);
12 }
13
14 if let Some(name) = device.product_string() {
15 print!("{} ", name);
16 }
17
18 if let Some(name) = device.serial_number() {
19 print!("{} ", name);
20 }
21
22 println!();
23 }
24}
Sourcepub fn serial_number(&self) -> Option<String>
pub fn serial_number(&self) -> Option<String>
The serial number.
Examples found in repository?
examples/list.rs (line 18)
3fn main() {
4 let hid = hid::init().unwrap();
5
6 for device in hid.devices() {
7 print!("{} ", device.path().to_str().unwrap());
8 print!("ID {:x}:{:x} ", device.vendor_id(), device.product_id());
9
10 if let Some(name) = device.manufacturer_string() {
11 print!("{} ", name);
12 }
13
14 if let Some(name) = device.product_string() {
15 print!("{} ", name);
16 }
17
18 if let Some(name) = device.serial_number() {
19 print!("{} ", name);
20 }
21
22 println!();
23 }
24}
Sourcepub fn manufacturer_string(&self) -> Option<String>
pub fn manufacturer_string(&self) -> Option<String>
The manufacturer string.
Examples found in repository?
examples/list.rs (line 10)
3fn main() {
4 let hid = hid::init().unwrap();
5
6 for device in hid.devices() {
7 print!("{} ", device.path().to_str().unwrap());
8 print!("ID {:x}:{:x} ", device.vendor_id(), device.product_id());
9
10 if let Some(name) = device.manufacturer_string() {
11 print!("{} ", name);
12 }
13
14 if let Some(name) = device.product_string() {
15 print!("{} ", name);
16 }
17
18 if let Some(name) = device.serial_number() {
19 print!("{} ", name);
20 }
21
22 println!();
23 }
24}
Sourcepub fn product_string(&self) -> Option<String>
pub fn product_string(&self) -> Option<String>
The product string.
Examples found in repository?
examples/list.rs (line 14)
3fn main() {
4 let hid = hid::init().unwrap();
5
6 for device in hid.devices() {
7 print!("{} ", device.path().to_str().unwrap());
8 print!("ID {:x}:{:x} ", device.vendor_id(), device.product_id());
9
10 if let Some(name) = device.manufacturer_string() {
11 print!("{} ", name);
12 }
13
14 if let Some(name) = device.product_string() {
15 print!("{} ", name);
16 }
17
18 if let Some(name) = device.serial_number() {
19 print!("{} ", name);
20 }
21
22 println!();
23 }
24}
Sourcepub fn release_number(&self) -> u16
pub fn release_number(&self) -> u16
The release number.
Sourcepub fn usage_page(&self) -> u16
pub fn usage_page(&self) -> u16
The usage page.
Sourcepub fn interface_number(&self) -> isize
pub fn interface_number(&self) -> isize
The interface number.
Auto Trait Implementations§
impl<'a> Freeze for Device<'a>
impl<'a> RefUnwindSafe for Device<'a>
impl<'a> !Send for Device<'a>
impl<'a> !Sync for Device<'a>
impl<'a> Unpin for Device<'a>
impl<'a> UnwindSafe for Device<'a>
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