-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
63 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,21 @@ | ||
pub enum {{ name }} { | ||
{% for variant in variants %} | ||
{{ variant.name }} {% if let Some(types) = variant.types %}({% for ty in types %} {{ ty }}, {% endfor %}) {% endif %}, | ||
{{ variant.name }} | ||
{% match variant.ty %} | ||
{% when TypeTemplate::Unit %} | ||
{% when TypeTemplate::Tuple with (types) %} | ||
( | ||
{% for ty in types %} | ||
{{ ty }}, | ||
{% endfor %} | ||
) | ||
{% when TypeTemplate::Named with { fields } %} | ||
{ | ||
{% for field in fields %} | ||
{{ field.name }}: {{ field.ty }}, | ||
{% endfor %} | ||
} | ||
{% endmatch %} | ||
, | ||
{% endfor %} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,14 @@ expression: rendered | |
--- | ||
pub enum Simple { | ||
|
||
One , | ||
One | ||
|
||
|
||
, | ||
|
||
Two , | ||
Two | ||
|
||
|
||
, | ||
|
||
} |