Trait ToVec

Source
pub trait ToVec {
    // Required method
    fn to_vec_raw(&self) -> Result<Vec<u8>, GenError>;

    // Provided methods
    fn to_vec(&mut self) -> Result<Vec<u8>, GenError> { ... }
    fn fix(&mut self) { ... }
}
Available on crate feature serialize only.
Expand description

Common trait for all serialization functions

Required Methods§

Source

fn to_vec_raw(&self) -> Result<Vec<u8>, GenError>

Serialize to bytes representation (little-endian). Do not check values

Provided Methods§

Source

fn to_vec(&mut self) -> Result<Vec<u8>, GenError>

Serialize to bytes representation (little-endian). Check values and fix all fields before serializing.

Source

fn fix(&mut self)

Check and correct all fields: use magic, fix lengths fields and other values if possible.

Implementors§