aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-05 10:06:56 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-05 10:06:56 +0100
commit07cf1d545b0a060c52b3db4a15b19cfa2dfdc713 (patch)
treeec06f534d42484947a04b534c6f4aff351eba3a7
parentdabe982ab6ae2ecf2c225852df16bb70614f2a49 (diff)
downloadaskama-07cf1d545b0a060c52b3db4a15b19cfa2dfdc713.tar.gz
askama-07cf1d545b0a060c52b3db4a15b19cfa2dfdc713.tar.bz2
askama-07cf1d545b0a060c52b3db4a15b19cfa2dfdc713.zip
Move some code around to group related parts
Diffstat (limited to '')
-rw-r--r--askama/src/generator.rs54
1 files changed, 27 insertions, 27 deletions
diff --git a/askama/src/generator.rs b/askama/src/generator.rs
index 57d1205..3c5e2a1 100644
--- a/askama/src/generator.rs
+++ b/askama/src/generator.rs
@@ -21,33 +21,6 @@ impl Generator {
}
}
- fn annotations(&self, generics: &syn::Generics) -> String {
- if generics.lifetimes.len() < 1 {
- return String::new();
- }
- let mut res = String::new();
- res.push('<');
- for lt in &generics.lifetimes {
- res.push_str(lt.lifetime.ident.as_ref());
- }
- res.push('>');
- res
- }
-
- fn init(&mut self, name: &str, generics: &syn::Generics) {
- self.write("impl");
- let anno = self.annotations(generics);
- self.write(&anno);
- self.write(" askama::Template for ");
- self.write(name);
- self.write(&anno);
- self.writeln(" {");
-
- self.indent();
- self.writeln("fn render_into(&self, writer: &mut std::fmt::Write) {");
- self.indent();
- }
-
fn indent(&mut self) {
self.indent += 1;
}
@@ -187,6 +160,33 @@ impl Generator {
}
}
+ fn annotations(&self, generics: &syn::Generics) -> String {
+ if generics.lifetimes.len() < 1 {
+ return String::new();
+ }
+ let mut res = String::new();
+ res.push('<');
+ for lt in &generics.lifetimes {
+ res.push_str(lt.lifetime.ident.as_ref());
+ }
+ res.push('>');
+ res
+ }
+
+ fn init(&mut self, name: &str, generics: &syn::Generics) {
+ self.write("impl");
+ let anno = self.annotations(generics);
+ self.write(&anno);
+ self.write(" askama::Template for ");
+ self.write(name);
+ self.write(&anno);
+ self.writeln(" {");
+
+ self.indent();
+ self.writeln("fn render_into(&self, writer: &mut std::fmt::Write) {");
+ self.indent();
+ }
+
fn finalize(&mut self) {
self.dedent();
self.writeln("}");