Skip to main content

hopper_dynamic

Attribute Macro hopper_dynamic 

Source
#[hopper_dynamic]
Expand description

Declare which field of a #[repr(C)] struct is the dynamic-tail region.

Attaches to the struct, not the field, because stable Rust does not permit #[proc_macro_attribute] macros on struct fields. The field name is passed as a string via field = "<name>".

§Example

#[hopper::dynamic(field = "entries")]
#[derive(Clone, Copy)]
#[hopper::state]
#[repr(C)]
pub struct Ledger {
    pub head: WireU64,
    pub tail: WireU64,
    pub entries: DynamicRegion<LedgerEntry>,
}