Trait packed_struct::PackedStructSlice
[−]
[src]
pub trait PackedStructSlice where
Self: Sized, { fn pack_to_slice(&self, output: &mut [u8]) -> Result<(), PackingError>; fn unpack_from_slice(src: &[u8]) -> Result<Self, PackingError>; fn packed_bytes() -> usize; fn pack_to_vec(&self) -> Result<Vec<u8>, PackingError> { ... } }
A structure that can be packed and unpacked from a slice of bytes.
Required Methods
fn pack_to_slice(&self, output: &mut [u8]) -> Result<(), PackingError>
Pack the structure into an output buffer.
fn unpack_from_slice(src: &[u8]) -> Result<Self, PackingError>
Unpack the structure from a buffer.
fn packed_bytes() -> usize
Number of bytes that this structure demands for packing or unpacking.
Provided Methods
fn pack_to_vec(&self) -> Result<Vec<u8>, PackingError>
Pack the structure into a new byte vector.
Implementations on Foreign Types
impl PackedStructSlice for bool
[src]
fn pack_to_slice(&self, output: &mut [u8]) -> Result<(), PackingError>
[src]
fn unpack_from_slice(src: &[u8]) -> Result<Self, PackingError>
[src]
fn packed_bytes() -> usize
[src]
fn pack_to_vec(&self) -> Result<Vec<u8>, PackingError>
[src]
impl PackedStructSlice for u8
[src]
fn pack_to_slice(&self, output: &mut [u8]) -> Result<(), PackingError>
[src]
fn unpack_from_slice(src: &[u8]) -> Result<Self, PackingError>
[src]
fn packed_bytes() -> usize
[src]
fn pack_to_vec(&self) -> Result<Vec<u8>, PackingError>
[src]
impl PackedStructSlice for i8
[src]
fn pack_to_slice(&self, output: &mut [u8]) -> Result<(), PackingError>
[src]
fn unpack_from_slice(src: &[u8]) -> Result<Self, PackingError>
[src]
fn packed_bytes() -> usize
[src]
fn pack_to_vec(&self) -> Result<Vec<u8>, PackingError>
[src]
Implementors
impl<T, B, I> PackedStructSlice for MsbInteger<T, B, I> where
B: NumberOfBits,
I: SizedInteger<T, B>,impl<T, B, I> PackedStructSlice for LsbInteger<T, B, I> where
B: NumberOfBits + BitsFullBytes,
I: SizedInteger<T, B>,impl<V, B> PackedStructSlice for ReservedBits<V, B> where
Self: Default,
V: ReservedBitValue,
B: NumberOfBits,