[−][src]Macro rdxl::xtype
xtype!() { /* proc-macro */ }
The xtype! macro defines an xml element and subelements
xtype! removes some of the redundancy of defining types having many attribute fields and many heterogenous children elements. A typical type definition that is a good fit for this macro would be coincidentally most XML elements.
In xtype!, a definition might look like this:
xtype!(<!MyList my_string:String my_int:u64> <!MyItem my_bool:bool/> <!MyOtherItem my_char:char/> <?MyPredefinedType/> </MyList>);
In sugar-free Rust this would become like this:
type MyItem { my_bool: bool } type MyOtherItem { my_char: char } enum MyListChildren { MyItem(MyItem), MyOtherItem(MyOtherItem), MyPredefinedType(MyPredefinedType) } struct MyList { my_string: String, my_int: u64, children: Vec<MyListChildren> }