We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It uses value of the first method call instead of calling the method each time. E.g.
use askama::Template; use rand::prelude::*; #[derive(Template)] #[template( source = "{{ rnd.gen() }} {{ rnd.gen() }}", ext = "txt", print = "code" )] struct Foo { rnd: Rnd, } struct Rnd; impl Rnd { fn gen(&self) -> i32 { rand::thread_rng().gen() } } fn main() { let foo = Foo { rnd: Rnd {} }; dbg!(foo.render().unwrap()); }
Generates
"{expr0} {expr0}", expr0 = &::askama::MarkupDisplay::new_unsafe(&(self.rnd.gen()), ::askama::Text),
As you can see {expr0} is calculated only once.
{expr0}
The text was updated successfully, but these errors were encountered:
This was added in #154. I will add a fix, that checks what kind of expression it is, to avoid that issue
Sorry, something went wrong.
Skip caching calls (Resolves #667)
393060f
78db190
No branches or pull requests
It uses value of the first method call instead of calling the method each time. E.g.
Generates
As you can see
{expr0}
is calculated only once.The text was updated successfully, but these errors were encountered: