Trait packtool::Packed [−][src]
pub trait Packed: Sized { const SIZE: usize; fn unchecked_read_from_slice(slice: &[u8]) -> Self; fn unchecked_write_to_slice(&self, _slice: &mut [u8]); fn check(slice: &[u8]) -> Result<(), Error>; fn read(view: View<'_, Self>) -> Self { ... } }
Expand description
trait to define how a fixed size Packed object is serialized into a byte slice representation.
see crate documentation for more information.
Associated Constants
the static size of a packed object in a byte array
this is not necessarily the ::std::mem::size_of::<Self>()
but the size it takes to have this object on a slice of memory.
Required methods
fn unchecked_read_from_slice(slice: &[u8]) -> Self
[src]
fn unchecked_read_from_slice(slice: &[u8]) -> Self
[src]assuming the given slice if valid, perform a conversion from the slice to the object.
fn unchecked_write_to_slice(&self, _slice: &mut [u8])
[src]
fn unchecked_write_to_slice(&self, _slice: &mut [u8])
[src]assuming there is enough slice available in the