Created
July 5, 2020 19:06
-
-
Save wwkeyboard/410584b06048bf5116ae1074344cde94 to your computer and use it in GitHub Desktop.
Trying to render a safe string into a askama template.
This file contains hidden or 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
use askama::Template; | |
#[derive(Template)] | |
#[template(source = "hello {{ name | safe }}", ext = "txt")] | |
struct HelloTemplate<'a> { | |
name: &'a str, | |
} | |
fn main() { | |
let hello = HelloTemplate { name: "world" }; | |
println!("{}", hello.render().unwrap()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment