diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-07-01 15:44:04 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-07-31 10:27:15 +0200 |
commit | 91e3c88d8f6428d41326869bbd8f6ece99145627 (patch) | |
tree | 76308a10c6de2e7fd4c1ba63924a261197a74370 /askama_derive/src/lib.rs | |
parent | 8b184511edff62bd3786be3f5d62c1965430278b (diff) | |
download | askama-91e3c88d8f6428d41326869bbd8f6ece99145627.tar.gz askama-91e3c88d8f6428d41326869bbd8f6ece99145627.tar.bz2 askama-91e3c88d8f6428d41326869bbd8f6ece99145627.zip |
derive: define separate ParseError type
Diffstat (limited to '')
-rw-r--r-- | askama_derive/src/lib.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/askama_derive/src/lib.rs b/askama_derive/src/lib.rs index 0683e71..1483438 100644 --- a/askama_derive/src/lib.rs +++ b/askama_derive/src/lib.rs @@ -12,6 +12,7 @@ mod generator; mod heritage; mod input; mod parser; +use parser::ParseError; #[proc_macro_derive(Template, attributes(template))] pub fn derive_template(input: TokenStream) -> TokenStream { @@ -48,6 +49,13 @@ impl fmt::Display for CompileError { } } +impl From<ParseError> for CompileError { + #[inline] + fn from(e: ParseError) -> Self { + Self::new(e.to_string(), Span::call_site()) + } +} + impl From<&'static str> for CompileError { #[inline] fn from(s: &'static str) -> Self { |