diff options
author | René Kijewski <kijewski@library.vetmed.fu-berlin.de> | 2022-05-24 14:20:09 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2022-05-24 16:41:32 +0200 |
commit | 064077a9001e121a12fc234fee44514840380a0e (patch) | |
tree | 9de78005b5049abfd313c3c5e652a5e37a980f17 /askama_shared/src/lib.rs | |
parent | e30cad33fd28c0d2546fbd70afa6834bea195f9e (diff) | |
download | askama-064077a9001e121a12fc234fee44514840380a0e.tar.gz askama-064077a9001e121a12fc234fee44514840380a0e.tar.bz2 askama-064077a9001e121a12fc234fee44514840380a0e.zip |
Move code generation into askama_derive
Diffstat (limited to '')
-rw-r--r-- | askama_shared/src/lib.rs | 51 |
1 files changed, 0 insertions, 51 deletions
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: Into<Cow<'static, str>>>(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<String> for CompileError { - #[inline] - fn from(s: String) -> Self { - Self::new(s, Span::call_site()) - } -} - #[cfg(test)] #[allow(clippy::blacklisted_name)] mod tests { |