Attribute Macro lazy_re

Source
#[lazy_re]
Expand description

This proc macro will generate padding fields for your struct every time you have a struct that has fields with the macro.

§Example

use lazy_re::lazy_re;
#[lazy_re]
#[repr(C, packed)]
pub struct Foo {
    #[lazy_re(offset = 0x42)]
    pub foo: usize
}

This struct now will be expanded to a struct with two fields and its respective padding:

use lazy_re::lazy_re;
#[lazy_re]
#[repr(C, packed)]
pub struct Foo {
    __pad000: [u8; 0x42],
    pub foo: usize
}

The utility of this macro is when you’re reverse engineering something and you’re only interested in some fields of a big struct, you can use this macro to cast raw pointers.