Macro struct_gen::struct_gen [−][src]
macro_rules! struct_gen { ($s:ident <$($lt: tt),+> {$( $i: ident : $t: ty)*} ) => { ... }; ($s:ident {$( $i: ident : $t: ty)*} ) => { ... }; }
struct_gen!
is a macro for generating struct definitions and constructors.
struct_gen
struct_gen!
is the macro at the heart of this crate. It is responsible for generating
the boilerplate for a struct, from defining the struct to implementing its static
constructor method. Ultimately, it is desirable for this macro to be as abstract and as
flexible as possible, accepting struct's with:
- lifetimes
- smart pointers
- generics
- optional non-default/zero values per field in the constructor
- etc.
Example
struct_gen!( Example { height: i32 size: f64 thing: char } );