From 064077a9001e121a12fc234fee44514840380a0e Mon Sep 17 00:00:00 2001 From: René Kijewski Date: Tue, 24 May 2022 14:20:09 +0200 Subject: Move code generation into askama_derive --- askama_shared/src/lib.rs | 51 ------------------------------------------------ 1 file changed, 51 deletions(-) (limited to 'askama_shared/src/lib.rs') diff --git a/askama_shared/src/lib.rs b/askama_shared/src/lib.rs index a3ee4c1..cb26406 100644 --- a/askama_shared/src/lib.rs +++ b/askama_shared/src/lib.rs @@ -3,23 +3,14 @@ #![deny(elided_lifetimes_in_paths)] #![deny(unreachable_pub)] -use std::borrow::Cow; use std::fmt; -pub use crate::generator::derive_template; -pub use crate::input::extension_to_mime_type; pub use askama_escape::MarkupDisplay; -use proc_macro2::{Span, TokenStream}; -mod config; mod error; pub use crate::error::{Error, Result}; pub mod filters; -mod generator; pub mod helpers; -mod heritage; -mod input; -mod parser; /// Main `Template` trait; implementations are generally derived /// @@ -107,48 +98,6 @@ impl fmt::Display for dyn DynTemplate { } } -#[derive(Debug, Clone)] -struct CompileError { - msg: Cow<'static, str>, - span: Span, -} - -impl CompileError { - fn new>>(s: S, span: Span) -> Self { - Self { - msg: s.into(), - span, - } - } - - fn into_compile_error(self) -> TokenStream { - syn::Error::new(self.span, self.msg).to_compile_error() - } -} - -impl std::error::Error for CompileError {} - -impl fmt::Display for CompileError { - #[inline] - fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt.write_str(&self.msg) - } -} - -impl From<&'static str> for CompileError { - #[inline] - fn from(s: &'static str) -> Self { - Self::new(s, Span::call_site()) - } -} - -impl From for CompileError { - #[inline] - fn from(s: String) -> Self { - Self::new(s, Span::call_site()) - } -} - #[cfg(test)] #[allow(clippy::blacklisted_name)] mod tests { -- cgit