aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama_derive/src/lib.rs8
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 {