Skip to main content

LowerData

Derive Macro LowerData 

Source
#[derive(LowerData)]
{
    // Attributes available to this derive:
    #[lower]
}
Expand description

Generate builder-to-runtime data lowering for a named-field structure.

ยงExample

use wowlab_engine_macros::LowerData;

struct RuntimeData {
    value: i32,
}
struct LowerContext;

#[derive(LowerData)]
#[lower(data = "RuntimeData", ctx = "LowerContext")]
struct Draft {
    #[lower(copy)]
    value: i32,
}

let data = Draft { value: 11 }.into_data(&mut LowerContext);
assert_eq!(data.value, 11);