pub struct Unit(/* private fields */);Expand description
Unit values.
§Data (Little Endian)
The Unit item qualifies value in the unit of nibbles. i.e., bit 3-0 is the nibble 0, bit 7-4 is the nibble 1, and so on.
| Nibble | System | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|---|
| 0 | System | None | SI Linear | SI Rotation | English Linear | English Rotation |
| 1 | Length | None | Centimeter | Radians | Inch | Degrees |
| 2 | Mass | None | Gram | Gram | Slug | Slug |
| 3 | Time | None | Seconds | Seconds | Seconds | Seconds |
| 4 | Temperature | None | Kelvin | Kelvin | Fahrenheit | Fahrenheit |
| 5 | Current | None | Ampere | Ampere | Ampere | Ampere |
| 6 | Luminous Intensity | None | Candela | Candela | Candela | Candela |
Codes 0x5-0xE are reserved; code 0xF is vendor-defined.
Implementations§
Source§impl Unit
impl Unit
Sourcepub const PREFIX: u8 = 100u8
pub const PREFIX: u8 = 100u8
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 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 Unit
impl StructuralPartialEq for Unit
Auto Trait Implementations§
impl Freeze for Unit
impl RefUnwindSafe for Unit
impl Send for Unit
impl Sync for Unit
impl Unpin for Unit
impl UnwindSafe for Unit
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