Trait packed_struct::PackedStructSlice
source · pub trait PackedStructSlicewhere
Self: Sized,{
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>;
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
sourcefn pack_to_slice(&self, output: &mut [u8]) -> PackingResult<()>
fn pack_to_slice(&self, output: &mut [u8]) -> PackingResult<()>
Pack the structure into an output buffer.
sourcefn unpack_from_slice(src: &[u8]) -> PackingResult<Self>
fn unpack_from_slice(src: &[u8]) -> PackingResult<Self>
Unpack the structure from a buffer.
sourcefn packed_bytes_size(opt_self: Option<&Self>) -> PackingResult<usize>
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
fn pack_to_vec(&self) -> PackingResult<Vec<u8>>
Implementations on Foreign Types
sourceimpl<A, B, C, D, E, F, G, H, I, J> PackedStructSlice for (A, B, C, D, E, F, G, H, I, J)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
F: PackedStructSlice,
G: PackedStructSlice,
H: PackedStructSlice,
I: PackedStructSlice,
J: PackedStructSlice,
impl<A, B, C, D, E, F, G, H, I, J> PackedStructSlice for (A, B, C, D, E, F, G, H, I, J)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
F: PackedStructSlice,
G: PackedStructSlice,
H: PackedStructSlice,
I: PackedStructSlice,
J: PackedStructSlice,
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>
sourceimpl<A, B, C, D, E, F, G, H, I> PackedStructSlice for (A, B, C, D, E, F, G, H, I)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
F: PackedStructSlice,
G: PackedStructSlice,
H: PackedStructSlice,
I: PackedStructSlice,
impl<A, B, C, D, E, F, G, H, I> PackedStructSlice for (A, B, C, D, E, F, G, H, I)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
F: PackedStructSlice,
G: PackedStructSlice,
H: PackedStructSlice,
I: PackedStructSlice,
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>
sourceimpl<A, B, C, D, E, F, G, H> PackedStructSlice for (A, B, C, D, E, F, G, H)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
F: PackedStructSlice,
G: PackedStructSlice,
H: PackedStructSlice,
impl<A, B, C, D, E, F, G, H> PackedStructSlice for (A, B, C, D, E, F, G, H)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
F: PackedStructSlice,
G: PackedStructSlice,
H: PackedStructSlice,
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>
sourceimpl<A, B, C, D, E, F, G> PackedStructSlice for (A, B, C, D, E, F, G)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
F: PackedStructSlice,
G: PackedStructSlice,
impl<A, B, C, D, E, F, G> PackedStructSlice for (A, B, C, D, E, F, G)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
F: PackedStructSlice,
G: PackedStructSlice,
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>
sourceimpl<A, B, C, D, E, F> PackedStructSlice for (A, B, C, D, E, F)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
F: PackedStructSlice,
impl<A, B, C, D, E, F> PackedStructSlice for (A, B, C, D, E, F)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
F: PackedStructSlice,
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>
sourceimpl<A, B, C, D, E> PackedStructSlice for (A, B, C, D, E)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
impl<A, B, C, D, E> PackedStructSlice for (A, B, C, D, E)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
E: PackedStructSlice,
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>
sourceimpl<A, B, C, D> PackedStructSlice for (A, B, C, D)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
impl<A, B, C, D> PackedStructSlice for (A, B, C, D)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
D: PackedStructSlice,
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>
sourceimpl<A, B, C> PackedStructSlice for (A, B, C)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
impl<A, B, C> PackedStructSlice for (A, B, C)where
A: PackedStructSlice,
B: PackedStructSlice,
C: PackedStructSlice,
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>
sourceimpl<A, B> PackedStructSlice for (A, B)where
A: PackedStructSlice,
B: PackedStructSlice,
impl<A, B> PackedStructSlice for (A, B)where
A: PackedStructSlice,
B: PackedStructSlice,
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>
sourceimpl<A> PackedStructSlice for (A,)where
A: PackedStructSlice,
impl<A> PackedStructSlice for (A,)where
A: PackedStructSlice,
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>
sourceimpl<T> PackedStructSlice for Vec<T>where
T: PackedStructSlice,
impl<T> PackedStructSlice for Vec<T>where
T: PackedStructSlice,
This can only be used as a vector of structures that have a statically known size
fn pack_to_slice(&self, output: &mut [u8]) -> Result<(), PackingError>
fn unpack_from_slice(src: &[u8]) -> Result<Self, PackingError>
fn packed_bytes_size(opt_self: Option<&Self>) -> Result<usize, PackingError>
Implementors
impl<T> PackedStructSlice for Twhere
T: PackedStruct,
T::ByteArray: ByteArray,
Slice unpacking for byte arrays