pub struct UsbId<const ID: u8, T> { /* private fields */ }
Expand description
Represents a generic USB ID in the USB database.
Not designed to be used directly; use one of the type aliases instead.
Implementations§
source§impl UsbId<PROTOCOL_TAG, u8>
impl UsbId<PROTOCOL_TAG, u8>
sourcepub fn from_cid_scid_pid(
class_id: u8,
subclass_id: u8,
id: u8,
) -> Option<&'static Self>
pub fn from_cid_scid_pid( class_id: u8, subclass_id: u8, id: u8, ) -> Option<&'static Self>
Returns the Protocol
corresponding to the given class, subclass, and protocol IDs,
or None
if no such protocol exists in the DB.
use usb_ids::Protocol;
let protocol = Protocol::from_cid_scid_pid(0x02, 0x02, 0x05).unwrap();
assert_eq!(protocol.name(), "AT-commands (3G)");
source§impl UsbId<HID_USAGE_TAG, u16>
impl UsbId<HID_USAGE_TAG, u16>
sourcepub fn from_pageid_uid(page_id: u8, id: u16) -> Option<&'static Self>
pub fn from_pageid_uid(page_id: u8, id: u16) -> Option<&'static Self>
Returns the HidUsage
corresponding to the given usage page and usage ID,
or None
if no such usage exists in the DB.
use usb_ids::HidUsage;
let hid_usage = HidUsage::from_pageid_uid(0x01, 0x002).unwrap();
assert_eq!(hid_usage.name(), "Mouse");
source§impl UsbId<DIALECT_TAG, u8>
impl UsbId<DIALECT_TAG, u8>
sourcepub fn from_lid_did(language_id: u16, id: u8) -> Option<&'static Self>
pub fn from_lid_did(language_id: u16, id: u8) -> Option<&'static Self>
Returns the Dialect
corresponding to the given language and dialect IDs,
or None
if no such dialect exists in the DB.
use usb_ids::Dialect;
let dialect = Dialect::from_lid_did(0x0007, 0x02).unwrap();
assert_eq!(dialect.name(), "Swiss");
Trait Implementations§
source§impl<const ID: u8, T: PartialEq> PartialEq for UsbId<ID, T>
impl<const ID: u8, T: PartialEq> PartialEq for UsbId<ID, T>
impl<const ID: u8, T: Copy> Copy for UsbId<ID, T>
impl<const ID: u8, T: Eq> Eq for UsbId<ID, T>
impl<const ID: u8, T> StructuralPartialEq for UsbId<ID, T>
Auto Trait Implementations§
impl<const ID: u8, T> Freeze for UsbId<ID, T>where
T: Freeze,
impl<const ID: u8, T> RefUnwindSafe for UsbId<ID, T>where
T: RefUnwindSafe,
impl<const ID: u8, T> Send for UsbId<ID, T>where
T: Send,
impl<const ID: u8, T> Sync for UsbId<ID, T>where
T: Sync,
impl<const ID: u8, T> Unpin for UsbId<ID, T>where
T: Unpin,
impl<const ID: u8, T> UnwindSafe for UsbId<ID, T>where
T: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)