pub struct Usage { /* private fields */ }Expand description
Usage index for an item usage; represents a suggested usage for the item or collection.
In the case where an item represents multiple controls, a Usage tag may suggest a usage for every variable or element in an array.
§Data (Little Endian)
Depends on the value of UsagePage. See HID Usage Tables FOR Universal Serial Bus.
Implementations§
Source§impl Usage
impl Usage
Sourcepub const PREFIX: u8 = 8u8
pub const PREFIX: u8 = 8u8
Prefix consists of tag(bit 7-4), type(bit 3-2) and size(bit 1-0).
The “size” part is set to 00 in this constant value.
Sourcepub unsafe fn new_unchecked(raw: &[u8]) -> Self
pub unsafe fn new_unchecked(raw: &[u8]) -> Self
Sourcepub fn set_usage_page(&mut self, usage_page: UsagePage)
pub fn set_usage_page(&mut self, usage_page: UsagePage)
If you want more detailed content printed when formatting, you need to set the related usage page.
§Equality
Equality between two Usage items ignores usage page.
Sourcepub fn usage_page(&self) -> Option<&UsagePage>
pub fn usage_page(&self) -> Option<&UsagePage>
Get usage page.
Sourcepub fn new_with(data: &[u8]) -> Result<Self, HidError>
pub fn new_with(data: &[u8]) -> Result<Self, HidError>
Create an item with specific data.
NOTE: data size must be: 0, 1, 2 or 4.
Trait Implementations§
impl Eq for Usage
Auto Trait Implementations§
impl Freeze for Usage
impl RefUnwindSafe for Usage
impl Send for Usage
impl Sync for Usage
impl Unpin for Usage
impl UnwindSafe for Usage
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