[][src]Macro neli::drive_serialize

macro_rules! drive_serialize {
    ($to_ser:expr, $buffer:expr, $pos:expr) => { ... };
    ($to_ser:expr, $buffer:expr, $pos:expr, $size:ident) => { ... };
    (PAD $self:expr, $buffer:expr, $pos:expr) => { ... };
    (END $buffer:expr, $pos:expr) => { ... };
}

This macro can be used to serialize a single field in a struct.

Examples

use neli::{err::SerError, Nl};

fn drive_serialize() -> Result<(), SerError> {
    let int = 6u16;
     
    let mut vec = vec![0; int.size()];
    let pos = neli::drive_serialize!(&int, vec.as_mut_slice(), 0);
    neli::drive_serialize!(END vec.as_mut_slice(), pos);
    Ok(())
}