aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/lib.rs
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-10-06 11:30:37 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-11-01 12:52:09 +0100
commit145420b68ebe6d310a81c8965f9a9e81aa4dbfe1 (patch)
tree137aab999cdf04241da3bce70c29e4ae7410fcb1 /askama_derive/src/lib.rs
parent94d3bc1dc039f26fb157e50215dcf139078ab231 (diff)
downloadaskama-145420b68ebe6d310a81c8965f9a9e81aa4dbfe1.tar.gz
askama-145420b68ebe6d310a81c8965f9a9e81aa4dbfe1.tar.bz2
askama-145420b68ebe6d310a81c8965f9a9e81aa4dbfe1.zip
Inline nested derive_template() implementation
Diffstat (limited to '')
-rw-r--r--askama_derive/src/lib.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/askama_derive/src/lib.rs b/askama_derive/src/lib.rs
index 8a737aa..3b80635 100644
--- a/askama_derive/src/lib.rs
+++ b/askama_derive/src/lib.rs
@@ -16,7 +16,11 @@ mod input;
#[proc_macro_derive(Template, attributes(template))]
pub fn derive_template(input: TokenStream) -> TokenStream {
- generator::derive_template(input)
+ let ast = syn::parse::<syn::DeriveInput>(input).unwrap();
+ match generator::build_template(&ast) {
+ Ok(source) => source.parse().unwrap(),
+ Err(e) => e.into_compile_error(),
+ }
}
#[derive(Debug, Clone)]