aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 28b8246..359de5a 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -136,17 +136,32 @@ impl<'a> Generator<'a> {
buf.writeln("Ok(())");
buf.writeln("}");
- buf.writeln("fn extension() -> Option<&'static str> {");
+ buf.writeln("fn extension(&self) -> Option<&'static str> {");
buf.writeln(&format!(
"{:?}",
self.input.path.extension().map(|s| s.to_str().unwrap())
));
buf.writeln("}");
+ buf.writeln("fn size_hint(&self) -> usize {");
+ buf.writeln(&format!("{}", size_hint));
+ buf.writeln("}");
+
+ buf.writeln("}");
+
+ self.write_header(buf, "::askama::SizedTemplate", None);
+
buf.writeln("fn size_hint() -> usize {");
buf.writeln(&format!("{}", size_hint));
buf.writeln("}");
+ buf.writeln("fn extension() -> Option<&'static str> {");
+ buf.writeln(&format!(
+ "{:?}",
+ self.input.path.extension().map(|s| s.to_str().unwrap())
+ ));
+ buf.writeln("}");
+
buf.writeln("}");
}