#[derive(Language)]
Expand description
The macro to derive Recursive
and corresponding Language
, Patterns
and smart constructor traits for a given recursive AST.
The type passed to Language
must satisfy the following conditions:
- It MUST NOT have any generic parameters.
- It MUST be an enum.
- Recursive variants MUST mention itself by
Self
, not the concrete name. - Recursive variants MUST have exactly on fields with one of the following type:
Box<Self>
[Box<Self>; N]
for constantN
Vec<Self>
T<Box<Self>>
forT: IntoLanguageChildren
.
- Non-recursive variants MUST NOT mention the type itself, and all the arguments must implement [
Eq
], [Ord
], [Hash
], and [Clone
].