Trait pcap_parser::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§