PackedStructSlice

Trait PackedStructSlice 

Source
pub trait PackedStructSlice
where Self: Sized,
{ // Required methods fn pack_to_slice(&self, output: &mut [u8]) -> PackingResult<()>; fn unpack_from_slice(src: &[u8]) -> PackingResult<Self>; fn packed_bytes_size(opt_self: Option<&Self>) -> PackingResult<usize>; // Provided method fn pack_to_vec(&self) -> PackingResult<Vec<u8>> { ... } }
Expand description

A structure that can be packed and unpacked from a slice of bytes.

Required Methods§

Source

fn pack_to_slice(&self, output: &mut [u8]) -> PackingResult<()>

Pack the structure into an output buffer.

Source

fn unpack_from_slice(src: &[u8]) -> PackingResult<Self>

Unpack the structure from a buffer.

Source

fn packed_bytes_size(opt_self: Option<&Self>) -> PackingResult<usize>

Number of bytes that the type or this particular instance of this structure demands for packing or unpacking.

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<A> PackedStructSlice for (A,)

Source§

impl<A, B> PackedStructSlice for (A, B)

Source§

impl<A, B, C> PackedStructSlice for (A, B, C)

Source§

impl<A, B, C, D> PackedStructSlice for (A, B, C, D)

Source§

impl<A, B, C, D, E> PackedStructSlice for (A, B, C, D, E)

Source§

impl<A, B, C, D, E, F> PackedStructSlice for (A, B, C, D, E, F)

Source§

impl<A, B, C, D, E, F, G> PackedStructSlice for (A, B, C, D, E, F, G)

Source§

impl<A, B, C, D, E, F, G, H> PackedStructSlice for (A, B, C, D, E, F, G, H)

Source§

impl<A, B, C, D, E, F, G, H, I> PackedStructSlice for (A, B, C, D, E, F, G, H, I)

Source§

impl<A, B, C, D, E, F, G, H, I, J> PackedStructSlice for (A, B, C, D, E, F, G, H, I, J)

Source§

impl<T> PackedStructSlice for Vec<T>

This can only be used as a vector of structures that have a statically known size

Implementors§

Source§

impl<T> PackedStructSlice for T

Slice unpacking for byte arrays