dexml

Macro dexml 

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

Derives Deserialization Logic Via Custom DSL Templating

§Borrow Syntax

// only one lifetime is allowed when borrowing data
struct MyStruct<'a> {
    field: &'a str,
    captured_attr: &'a str,
}

dexml! {
    // the ref keyword is for borrowing data
    ref MyStruct;

    Response {
        // force an attribute to be a certain value or capture it
        Field id="required_id" other=(captured_attr) {
            // capture named fields via parens
            (field)
        }
    }
}

§Owned Syntax

dexml! {
    // the use keyword tells the macro you don't need a lifetime on your impl
    use MyStruct;

    // your templating logic here
}