[−][src]Trait bee_common::packable::Packable
A trait to pack and unpack types to and from bytes.
Associated Types
type Error
Associated error type.
Required methods
fn packed_len(&self) -> usize
Returns the length of the packed bytes.
fn pack<W: Write>(&self, writer: &mut W) -> Result<(), Self::Error>
Packs the instance to bytes and writes them to the passed writer.
fn unpack<R: Read + ?Sized>(reader: &mut R) -> Result<Self, Self::Error> where
Self: Sized,
Self: Sized,
Reads bytes from the passed reader and unpacks them into an instance.
Provided methods
fn pack_new(&self) -> Result<Vec<u8>, Self::Error>
Packs the instance to bytes and writes them to a newly allocated vector.