Skip to main content

CtrlHeader

Struct CtrlHeader 

Source
pub struct CtrlHeader { /* private fields */ }

Implementations§

Source§

impl CtrlHeader

Source

pub const fn new() -> Self

Returns an instance with zero initialized data.

Source§

impl CtrlHeader

Source

pub const fn into_bytes(self) -> [u8; 4]

Returns the underlying bits.

§Layout

The returned byte array is layed out in the same way as described here.

Source

pub const fn from_bytes(bytes: [u8; 4]) -> Self

Converts the given bytes directly into the bitfield struct.

Source§

impl CtrlHeader

Source

pub fn packet_type(&self) -> <B7 as Specifier>::InOut

Returns the value of packet_type.

Source

pub fn packet_type_or_err( &self, ) -> Result<<B7 as Specifier>::InOut, InvalidBitPattern<<B7 as Specifier>::Bytes>>

Returns the value of packet_type.

§Errors

If the returned value contains an invalid bit pattern for packet_type.

Source

pub fn with_packet_type(self, new_val: <B7 as Specifier>::InOut) -> Self

Returns a copy of the bitfield with the value of packet_type set to the given value.

§Panics

If the given value is out of bounds for packet_type.

Source

pub fn with_packet_type_checked( self, new_val: <B7 as Specifier>::InOut, ) -> Result<Self, OutOfBounds>

Returns a copy of the bitfield with the value of packet_type set to the given value.

§Errors

If the given value is out of bounds for packet_type.

Source

pub fn set_packet_type(&mut self, new_val: <B7 as Specifier>::InOut)

Sets the value of packet_type to the given value.

§Panics

If the given value is out of bounds for packet_type.

Source

pub fn set_packet_type_checked( &mut self, new_val: <B7 as Specifier>::InOut, ) -> Result<(), OutOfBounds>

Sets the value of packet_type to the given value.

§Errors

If the given value is out of bounds for packet_type.

Source

pub fn reserved_flag(&self) -> <bool as Specifier>::InOut

Returns the value of reserved_flag. Reserved flag bit in the first byte, purpose unknown. IMPORTANT: This is NOT an indicator that an “extended header” is present.

Source

pub fn reserved_flag_or_err( &self, ) -> Result<<bool as Specifier>::InOut, InvalidBitPattern<<bool as Specifier>::Bytes>>

Returns the value of reserved_flag.

§Errors

If the returned value contains an invalid bit pattern for reserved_flag. Reserved flag bit in the first byte, purpose unknown. IMPORTANT: This is NOT an indicator that an “extended header” is present.

Source

pub fn with_reserved_flag(self, new_val: <bool as Specifier>::InOut) -> Self

Returns a copy of the bitfield with the value of reserved_flag set to the given value.

§Panics

If the given value is out of bounds for reserved_flag. Reserved flag bit in the first byte, purpose unknown. IMPORTANT: This is NOT an indicator that an “extended header” is present.

Source

pub fn with_reserved_flag_checked( self, new_val: <bool as Specifier>::InOut, ) -> Result<Self, OutOfBounds>

Returns a copy of the bitfield with the value of reserved_flag set to the given value.

§Errors

If the given value is out of bounds for reserved_flag. Reserved flag bit in the first byte, purpose unknown. IMPORTANT: This is NOT an indicator that an “extended header” is present.

Source

pub fn set_reserved_flag(&mut self, new_val: <bool as Specifier>::InOut)

Sets the value of reserved_flag to the given value.

§Panics

If the given value is out of bounds for reserved_flag. Reserved flag bit in the first byte, purpose unknown. IMPORTANT: This is NOT an indicator that an “extended header” is present.

Source

pub fn set_reserved_flag_checked( &mut self, new_val: <bool as Specifier>::InOut, ) -> Result<(), OutOfBounds>

Sets the value of reserved_flag to the given value.

§Errors

If the given value is out of bounds for reserved_flag. Reserved flag bit in the first byte, purpose unknown. IMPORTANT: This is NOT an indicator that an “extended header” is present.

Source

pub fn id(&self) -> <u8 as Specifier>::InOut

Returns the value of id.

Source

pub fn id_or_err( &self, ) -> Result<<u8 as Specifier>::InOut, InvalidBitPattern<<u8 as Specifier>::Bytes>>

Returns the value of id.

§Errors

If the returned value contains an invalid bit pattern for id.

Source

pub fn with_id(self, new_val: <u8 as Specifier>::InOut) -> Self

Returns a copy of the bitfield with the value of id set to the given value.

§Panics

If the given value is out of bounds for id.

Source

pub fn with_id_checked( self, new_val: <u8 as Specifier>::InOut, ) -> Result<Self, OutOfBounds>

Returns a copy of the bitfield with the value of id set to the given value.

§Errors

If the given value is out of bounds for id.

Source

pub fn set_id(&mut self, new_val: <u8 as Specifier>::InOut)

Sets the value of id to the given value.

§Panics

If the given value is out of bounds for id.

Source

pub fn set_id_checked( &mut self, new_val: <u8 as Specifier>::InOut, ) -> Result<(), OutOfBounds>

Sets the value of id to the given value.

§Errors

If the given value is out of bounds for id.

Source

pub fn attribute(&self) -> <B15 as Specifier>::InOut

Returns the value of attribute.

Source

pub fn attribute_or_err( &self, ) -> Result<<B15 as Specifier>::InOut, InvalidBitPattern<<B15 as Specifier>::Bytes>>

Returns the value of attribute.

§Errors

If the returned value contains an invalid bit pattern for attribute.

Source

pub fn with_attribute(self, new_val: <B15 as Specifier>::InOut) -> Self

Returns a copy of the bitfield with the value of attribute set to the given value.

§Panics

If the given value is out of bounds for attribute.

Source

pub fn with_attribute_checked( self, new_val: <B15 as Specifier>::InOut, ) -> Result<Self, OutOfBounds>

Returns a copy of the bitfield with the value of attribute set to the given value.

§Errors

If the given value is out of bounds for attribute.

Source

pub fn set_attribute(&mut self, new_val: <B15 as Specifier>::InOut)

Sets the value of attribute to the given value.

§Panics

If the given value is out of bounds for attribute.

Source

pub fn set_attribute_checked( &mut self, new_val: <B15 as Specifier>::InOut, ) -> Result<(), OutOfBounds>

Sets the value of attribute to the given value.

§Errors

If the given value is out of bounds for attribute.

Trait Implementations§

Source§

impl CheckTotalSizeMultipleOf8 for CtrlHeader

Source§

type Size = TotalSize<BitCount<#[derive(Debug, Clone, Copy, PartialEq)] pub struct CtrlHeader { pub packet_type: B7, /// Reserved flag bit in the first byte, purpose unknown. /// IMPORTANT: This is NOT an indicator that an "extended header" is present. pub reserved_flag: bool, pub id: u8, #[skip] unused: bool, pub attribute: B15, }>>

Source§

impl Clone for CtrlHeader

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for CtrlHeader

Source§

impl Debug for CtrlHeader

Source§

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

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

impl From<CtrlHeader> for [u8; 4]

Source§

fn from(bytes: CtrlHeader) -> Self

Converts to this type from the input type.
Source§

impl From<[u8; 4]> for CtrlHeader

Source§

fn from(bytes: [u8; 4]) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for CtrlHeader

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CtrlHeader

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more