diff options
author | René Kijewski <rene.kijewski@fu-berlin.de> | 2023-01-24 09:21:52 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-01-30 10:10:49 +0100 |
commit | 58e02a4fb6f6d58ff68d18f24abcfc8cab53f7be (patch) | |
tree | 2436bc202212b34ec25f7cd143c2f2285966ae50 /askama_derive/src/input.rs | |
parent | 3003d86264680433e789d2726d0d12d2c6267c40 (diff) | |
download | askama-58e02a4fb6f6d58ff68d18f24abcfc8cab53f7be.tar.gz askama-58e02a4fb6f6d58ff68d18f24abcfc8cab53f7be.tar.bz2 askama-58e02a4fb6f6d58ff68d18f24abcfc8cab53f7be.zip |
derive: Make Config `'static`
The configuration is made `'static`, because `toml` and `toml_edit` both
needs to implement serde's `DeserializeOwned` by now. We allocate the
strings once per template, so it is very unlikely that this change will
have any measurable impact, neither in compile time nor RAM usage.
Diffstat (limited to 'askama_derive/src/input.rs')
-rw-r--r-- | askama_derive/src/input.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/askama_derive/src/input.rs b/askama_derive/src/input.rs index 47d51bd..b8a0da4 100644 --- a/askama_derive/src/input.rs +++ b/askama_derive/src/input.rs @@ -9,8 +9,8 @@ use mime::Mime; pub(crate) struct TemplateInput<'a> { pub(crate) ast: &'a syn::DeriveInput, - pub(crate) config: &'a Config<'a>, - pub(crate) syntax: &'a Syntax<'a>, + pub(crate) config: &'a Config, + pub(crate) syntax: &'a Syntax, pub(crate) source: Source, pub(crate) print: Print, pub(crate) escaper: &'a str, @@ -25,7 +25,7 @@ impl TemplateInput<'_> { /// `template()` attribute list fields. pub(crate) fn new<'n>( ast: &'n syn::DeriveInput, - config: &'n Config<'_>, + config: &'n Config, args: TemplateArgs, ) -> Result<TemplateInput<'n>, CompileError> { let TemplateArgs { @@ -51,7 +51,7 @@ impl TemplateInput<'_> { // Validate syntax let syntax = syntax.map_or_else( - || Ok(config.syntaxes.get(config.default_syntax).unwrap()), + || Ok(config.syntaxes.get(&config.default_syntax).unwrap()), |s| { config .syntaxes |