Trait packed_struct::PackedStruct[][src]

pub trait PackedStruct where
    Self: Sized
{ type ByteArray: ByteArray; fn pack(&self) -> PackingResult<Self::ByteArray>;
fn unpack(src: &Self::ByteArray) -> PackingResult<Self>; }
Expand description

A structure that can be packed and unpacked from a byte array.

In case the structure occupies less bits than there are in the byte array, the packed that should be aligned to the end of the array, with leading bits being ignored.

10 bits packs into: [0b00000011, 0b11111111]

Associated Types

The appropriately sized byte array into which this structure will be packed, for example [u8; 2].

Required methods

Packs the structure into a byte array.

Unpacks the structure from a byte array.

Implementations on Foreign Types

Implementors