Constructors
Unless you include #[customize(constructors)]
, the #[term]
macro automatically creates constructors as follows:
- For a
struct
, defines anew
method that takes animpl Upcast<T>
for each of your fields. - For an
enum
, defines a method per variant that has fields (converted to snake-case).- If the name of the variant is a Rust keyword like
Struct
, the method will be calledstruct_
. - We do not generate constructors for variants with no arguments.
- If the name of the variant is a Rust keyword like