aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/generator.rs
diff options
context:
space:
mode:
Diffstat (limited to 'askama_derive/src/generator.rs')
-rw-r--r--askama_derive/src/generator.rs36
1 files changed, 18 insertions, 18 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index fb529a0..0d3dd5f 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -108,24 +108,6 @@ fn trait_name_for_path(path: &Path) -> String {
res
}
-fn get_parent_type(ast: &syn::DeriveInput) -> Option<&syn::Type> {
- match ast.data {
- syn::Data::Struct(syn::DataStruct {
- fields: syn::Fields::Named(ref fields),
- ..
- }) => fields.named.iter().filter_map(|f| {
- f.ident.as_ref().and_then(|name| {
- if name == "_parent" {
- Some(&f.ty)
- } else {
- None
- }
- })
- }),
- _ => panic!("derive(Template) only works for struct items"),
- }.next()
-}
-
struct Generator<'a> {
buf: String,
indent: u8,
@@ -974,6 +956,24 @@ impl<'a, T: 'a> SetChain<'a, T> where T: cmp::Eq + hash::Hash {
}
}
+fn get_parent_type(ast: &syn::DeriveInput) -> Option<&syn::Type> {
+ match ast.data {
+ syn::Data::Struct(syn::DataStruct {
+ fields: syn::Fields::Named(ref fields),
+ ..
+ }) => fields.named.iter().filter_map(|f| {
+ f.ident.as_ref().and_then(|name| {
+ if name == "_parent" {
+ Some(&f.ty)
+ } else {
+ None
+ }
+ })
+ }),
+ _ => panic!("derive(Template) only works for struct items"),
+ }.next()
+}
+
#[derive(Clone)]
enum AstLevel {
Top,