ReservedAndCounter

Struct ReservedAndCounter 

Source
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

Source

pub fn new() -> Self

Creates a new ReservedAndCounter with reserved=0x000 and counter=0x0.

Source

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)
Source

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)
Source

pub fn reserved(&self) -> u16

Gets the reserved field (should always be 0x000 per spec).

§Returns

12-bit reserved value

Source

pub fn counter(&self) -> u8

Gets the counter field (low 4 bits).

§Returns

Counter value (0-15)

Source

pub fn set_counter(&mut self, value: u8)

Sets the counter field (reserved remains 0x000).

§Parameters
  • value - Counter value (0-15, will be masked)
Source

pub fn as_u16(&self) -> u16

Converts to raw u16 value.

Source

pub fn from_u16(value: u16) -> Self

Creates from raw u16 value.

§Parameters
  • value - Raw 16-bit value from wire format
Source

pub fn to_be_bytes(&self) -> [u8; 2]

Converts to big-endian bytes for network transmission.

Source

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

Source§

fn clone(&self) -> ReservedAndCounter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReservedAndCounter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ReservedAndCounter

Source§

fn eq(&self, other: &ReservedAndCounter) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for ReservedAndCounter

Source§

impl Eq for ReservedAndCounter

Source§

impl StructuralPartialEq for ReservedAndCounter

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.