pub struct ReservedAndCounter(/* private fields */);Expand description
12-bit reserved field + 4-bit counter packed into a u16.
Used in EventGroup entries. The reserved field must be 0x000 per specification.
Implementations§
Source§impl ReservedAndCounter
impl ReservedAndCounter
Sourcepub fn from_fields(reserved: u16, counter: u8) -> Self
pub fn from_fields(reserved: u16, counter: u8) -> Self
Creates ReservedAndCounter from reserved (12-bit) and counter (4-bit) values.
§Parameters
reserved- Reserved field (12 bits, should be 0x000)counter- Counter field (4 bits, 0-15)
Sourcepub fn from_counter(counter: u8) -> Self
pub fn from_counter(counter: u8) -> Self
Creates from counter only (reserved will be 0x000 as per spec).
§Parameters
counter- Counter value (4 bits, 0-15)
Sourcepub fn set_counter(&mut self, value: u8)
pub fn set_counter(&mut self, value: u8)
Sets the counter field (reserved remains 0x000).
§Parameters
value- Counter value (0-15, will be masked)
Sourcepub fn to_be_bytes(&self) -> [u8; 2]
pub fn to_be_bytes(&self) -> [u8; 2]
Converts to big-endian bytes for network transmission.
Sourcepub fn from_be_bytes(bytes: [u8; 2]) -> Self
pub fn from_be_bytes(bytes: [u8; 2]) -> Self
Creates from big-endian bytes (for parsing from network).
§Parameters
bytes- 2-byte big-endian array
Trait Implementations§
Source§impl Clone for ReservedAndCounter
impl Clone for ReservedAndCounter
Source§fn clone(&self) -> ReservedAndCounter
fn clone(&self) -> ReservedAndCounter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReservedAndCounter
impl Debug for ReservedAndCounter
Source§impl PartialEq for ReservedAndCounter
impl PartialEq for ReservedAndCounter
impl Copy for ReservedAndCounter
impl Eq for ReservedAndCounter
impl StructuralPartialEq for ReservedAndCounter
Auto Trait Implementations§
impl Freeze for ReservedAndCounter
impl RefUnwindSafe for ReservedAndCounter
impl Send for ReservedAndCounter
impl Sync for ReservedAndCounter
impl Unpin for ReservedAndCounter
impl UnwindSafe for ReservedAndCounter
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