Skip to main content

define_slot

Macro define_slot 

Source
define_slot!() { /* proc-macro */ }
Expand description

Declare a non-generic, named-field dense-buffer slot.

ยงExample

pub mod _private {
    pub use bytemuck;
}

wowlab_engine_macros::define_slot! {
    pub struct ExampleSlot {
        pub value: f64,
        pub count: i32,
        pub _padding: i32,
    }
}

fn main() {
    let slot = ExampleSlot {
        value: 2.5,
        count: 3,
        _padding: 0,
    };
    let mut output = String::new();
    slot.dump_fields(&mut output);
    assert_eq!(ExampleSlot::OFF_VALUE, 0);
    assert!(output.contains("value"));
    assert!(!output.contains("_padding"));
}