Skip to main content

on_disk_struct

Macro on_disk_struct 

Source
macro_rules! on_disk_struct {
    (
        $(#[$attr:meta])*
        struct $struct_name:ident/$endianness:ident, $packed:ident {
            $(
                $(#[$id_attr:meta])*
                $identifier:ident: $type:ty[$offset:literal],
            )+
        }
    ) => { ... };
}
Expand description

Implement OnDiskStruct for the contained struct definition.

The struct name must be followed by a specification of endianness and whether to allow gaps in the field offsets, i.e.: struct <Struct>/<LE, BE, NE>, <no_gaps, allow_gaps>.

All field types must be annotated with their byte offset in the structure, e.g. foo: u32[42].