pub struct SubClass { /* private fields */ }
Expand description
Implementations§
source§impl SubClass
impl SubClass
sourcepub fn from_cid_scid(class_id: u8, id: u8) -> Option<&'static Self>
pub fn from_cid_scid(class_id: u8, id: u8) -> Option<&'static Self>
Returns the SubClass
corresponding to the given class and subclass IDs,
or None
if no such subclass exists in the DB.
use usb_ids::SubClass;
let subclass = SubClass::from_cid_scid(0x02, 0x03).unwrap();
assert_eq!(subclass.name(), "Telephone");
assert!(SubClass::from_cid_scid(0x3c, 0x02).is_none());
sourcepub fn class(&self) -> &'static Class
pub fn class(&self) -> &'static Class
Returns the Class
that this subclass belongs to.
Looking up a class by subclass is cheap (O(1)
).
use usb_ids::SubClass;
let subclass = SubClass::from_cid_scid(0x02, 0x03).unwrap();
let class = subclass.class();
assert_eq!(class.id(), 0x02);
sourcepub fn as_cid_scid(&self) -> (u8, u8)
pub fn as_cid_scid(&self) -> (u8, u8)
Returns a tuple of (class id, subclass id) for this subclass.
This is convenient for interactions with other USB libraries.
Trait Implementations§
source§impl PartialEq for SubClass
impl PartialEq for SubClass
impl Copy for SubClass
impl Eq for SubClass
impl StructuralPartialEq for SubClass
Auto Trait Implementations§
impl Freeze for SubClass
impl RefUnwindSafe for SubClass
impl Send for SubClass
impl Sync for SubClass
impl Unpin for SubClass
impl UnwindSafe for SubClass
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: 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
)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
)