Replies: 2 comments 2 replies
-
|
"it did not work". Great, I love divination. :) Some useful information:
|
Beta Was this translation helpful? Give feedback.
2 replies
-
|
Templates can be used with borrowed data, too: #[derive(Template)]
#[template(path = "parsed_content.html")]
struct ParsedContent<'a> {
tokens: &'a [Token]
}Then you can make the Token a Template, too: #[derive(Template)]
enum Token {
#[template(...)]
A,
#[template(...)]
B,
#[template(...)]
C,
}parsed_content.html: <ol>
{% for token in tokens %}
<li>{{ token | safe }}</li>
{% endfor %}
</ol> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I tried to apply a template to structure that contained enum and it did not work:
where
Tokenis the enum.I wounder if there is something I did not do to get it working, because example in the documentation is Enums with directly attached templates.
The only solution I currently see is the creation of the same data type and copy of data between the original and the target enum.
Beta Was this translation helpful? Give feedback.
All reactions