Trait winter_utils::Serializable [−][src]
pub trait Serializable: Sized { fn write_into<W: ByteWriter>(&self, target: &mut W); fn to_bytes(&self) -> Vec<u8>ⓘ { ... } fn write_batch_into<W: ByteWriter>(source: &[Self], target: &mut W) { ... } fn get_size_hint(&self) -> usize { ... } }
Expand description
Defines how to serialize Self into bytes.
Required methods
fn write_into<W: ByteWriter>(&self, target: &mut W)
fn write_into<W: ByteWriter>(&self, target: &mut W)
Serializes self into bytes and writes these bytes into the target.
Provided methods
Serializes self into a vector of bytes.
fn write_batch_into<W: ByteWriter>(source: &[Self], target: &mut W)
fn write_batch_into<W: ByteWriter>(source: &[Self], target: &mut W)
Serializes all elements of the source and writes these bytes into the target.
This method does not write any metadata (e.g. number of serialized elements) into the
target.
fn get_size_hint(&self) -> usize
fn get_size_hint(&self) -> usize
Returns an estimate of how many bytes are needed to represent self.
The default implementation returns zero.