Macro meta_default_constructor

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

The meta macro.

ยงSyntax

meta_default_constructor!(
    // conversion function
    [Into::into]
    // struct name and optional generics
    MyStruct::<T>
    // fields
    {
        // name value pairs like normal structs
        //
        // value is converted via the conversion function
        // name: Into::into(value),
        name: value,
        // use `effect` boxed to do another conversion like boxing, see the `effect` module.
        boxed: @boxed inner,
        // Nested structs will be recursively applied this macro
        // `OtherStruct` will be constructed recursively using the same `meta_default_constructor!`
        other: OtherStruct {
            ..
        },
        // Ignore this behavior like this.
        other2: {OtherStruct {
            ..
        }},
        // The `arr` effect uses the same conversion as fields.
        array: @arr [
            "Hello", "World!"
        ],
        // append [..Default::default()] at the end
    }
)