Trait packed_struct::types::SizedInteger[][src]

pub trait SizedInteger<T, B: NumberOfBits> where
    Self: Sized
{ fn value_bit_mask() -> T;
fn from_primitive(val: T) -> Self;
fn to_primitive(&self) -> T;
fn to_msb_bytes(
        &self
    ) -> PackingResult<<<B as NumberOfBits>::Bytes as NumberOfBytes>::AsBytes>;
fn to_lsb_bytes(
        &self
    ) -> PackingResult<<<B as NumberOfBits>::Bytes as NumberOfBytes>::AsBytes>;
fn from_msb_bytes(
        bytes: &<<B as NumberOfBits>::Bytes as NumberOfBytes>::AsBytes
    ) -> PackingResult<Self>;
fn from_lsb_bytes(
        bytes: &<<B as NumberOfBits>::Bytes as NumberOfBytes>::AsBytes
    ) -> PackingResult<Self>; }
Expand description

Convert an integer of a specific bit width into native types.

Required methods

The bit mask that is used for all incoming values. For an integer of width 8, that is 0xFF.

Convert from the platform native type, applying the value mask and preserving the correct signedness.

Convert to the platform’s native type.

Convert to a MSB byte representation. 0xAABB is converted into [0xAA, 0xBB].

Convert to a LSB byte representation. 0xAABB is converted into [0xBB, 0xAA].

Convert from a MSB byte array.

Convert from a LSB byte array.

Implementors