diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-02-12 13:52:16 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-02-12 13:52:16 +0100 |
commit | 2befc17e3deeabcb601c85f0d3e83ced66f4e3f5 (patch) | |
tree | 7a8265a754340de345eba75ab5889fdc10908942 | |
parent | d0481b8c62bf8765207912ce3856655384dbcfe9 (diff) | |
download | askama-2befc17e3deeabcb601c85f0d3e83ced66f4e3f5.tar.gz askama-2befc17e3deeabcb601c85f0d3e83ced66f4e3f5.tar.bz2 askama-2befc17e3deeabcb601c85f0d3e83ced66f4e3f5.zip |
Improve Generator impl/trait writing method names
-rw-r--r-- | askama/src/generator.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/askama/src/generator.rs b/askama/src/generator.rs index 9c3581d..7e84ce5 100644 --- a/askama/src/generator.rs +++ b/askama/src/generator.rs @@ -281,7 +281,7 @@ impl<'a> Generator<'a> { self.writeln("}"); } - fn template_impl(&mut self, ast: &syn::DeriveInput, nodes: &'a [Node]) { + fn impl_template(&mut self, ast: &syn::DeriveInput, nodes: &'a [Node]) { let anno = annotations(&ast.generics); self.writeln(&format!("impl{} askama::Template for {}{} {{", anno, ast.ident.as_ref(), anno)); @@ -298,7 +298,7 @@ impl<'a> Generator<'a> { self.writeln("}"); } - fn trait_impl(&mut self, ast: &syn::DeriveInput, base: &str, + fn impl_trait(&mut self, ast: &syn::DeriveInput, base: &str, block_names: &[&str]) { let anno = annotations(&ast.generics); self.writeln(&format!("impl{} TraitFrom{} for {}{} {{", @@ -321,7 +321,7 @@ impl<'a> Generator<'a> { self.writeln("}"); } - fn trait_based_impl(&mut self, ast: &syn::DeriveInput) { + fn impl_template_for_trait(&mut self, ast: &syn::DeriveInput) { let anno = annotations(&ast.generics); self.writeln(&format!("impl{} askama::Template for {}{} {{", anno, ast.ident.as_ref(), anno)); @@ -337,7 +337,7 @@ impl<'a> Generator<'a> { self.writeln("}"); } - fn template_trait(&mut self, ast: &syn::DeriveInput, path: &str, + fn define_trait(&mut self, ast: &syn::DeriveInput, path: &str, block_names: &[&str], nodes: &'a [Node]) { let anno = annotations(&ast.generics); self.writeln(&format!("trait{} TraitFrom{}{} {{", anno, @@ -394,16 +394,16 @@ pub fn generate(ast: &syn::DeriveInput, path: &str, mut nodes: Vec<Node>) -> Str if !blocks.is_empty() { gen.struct_impl(ast, &blocks); if base.is_none() { - gen.template_trait(ast, path, &block_names, &content); + gen.define_trait(ast, path, &block_names, &content); } let tmpl_path = match base { Some(Expr::StrLit(base_path)) => { base_path }, _ => { path }, }; - gen.trait_impl(ast, tmpl_path, &block_names); - gen.trait_based_impl(ast); + gen.impl_trait(ast, tmpl_path, &block_names); + gen.impl_template_for_trait(ast); } else { - gen.template_impl(ast, &content); + gen.impl_template(ast, &content); } gen.result() } |