Macro zero_formatter::struct_formatter [] [src]

macro_rules! struct_formatter {
    (#[target($buffer:ty)]
    $name:ident {
        $($field_name:ident: $field_type:ty),*
    }) => { ... };
}

struct_formatter define sturct type and provide sequential fields formatter. But, struct_formatter does not support versioning.

struct_formatter! {
    #[target(Buffer<Cursor<Vec<u8>>>)]
    StructSample {
        a: i32,
        b: i64
    }
}

try!(writer.serialize(0, StructSample { a: 1, b: 2 }));