Restrictions: Each enum variant should be tuple like with exactly one variant, wrapped type of each variant should implement Template
Semantics: While useless for top level pages(??), it may be handy for component templates:
- we make dispatch for template components automatic;
- their enumeration easy
- when one wants to render one of many variants of template, currently others still need to be initialized resulting in waste of memory as well as the need to fill unused variants somehow (hello
Option and template level matching)
Consider:
#[derive(Template)]
enum OrderStatus {
Arrived(ArrivedOrder),
Delivery(DeviveryOrder),
PendingConfirmation(ConfirmOrder)
}
Isn't that nice?
Edit: removed pointless annotation
Restrictions: Each enum variant should be tuple like with exactly one variant, wrapped type of each variant should implement
TemplateSemantics: While useless for top level pages(??), it may be handy for component templates:
Optionand template level matching)Consider:
Isn't that nice?
Edit: removed pointless annotation