aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-10 12:37:25 +0200
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-08-10 12:37:25 +0200
commit3b4c7e266bf9f2d1e6d23a190a8d45b77bd32e9b (patch)
tree72ca093aeda33ed72803a2b27a8633e059e0e0a6
parente8c47b7135a1ecf3414c6495b1cb592ae3e2d8a3 (diff)
downloadaskama-3b4c7e266bf9f2d1e6d23a190a8d45b77bd32e9b.tar.gz
askama-3b4c7e266bf9f2d1e6d23a190a8d45b77bd32e9b.tar.bz2
askama-3b4c7e266bf9f2d1e6d23a190a8d45b77bd32e9b.zip
Update debugging example in README
-rw-r--r--README.md20
1 files changed, 12 insertions, 8 deletions
diff --git a/README.md b/README.md
index f6271e9..f1fb0ae 100644
--- a/README.md
+++ b/README.md
@@ -141,14 +141,18 @@ Lit("", "!", "\n")]
The generated code looks like this:
```rust
-#[allow(dead_code, non_camel_case_types)]
-impl<'a> askama::Template for HelloTemplate<'a> {
- fn render_to(&self, writer: &mut std::fmt::Write) {
- writer.write_str("Hello,").unwrap();
- writer.write_str(" ").unwrap();
- writer.write_fmt(format_args!("{}", self.name)).unwrap();
- writer.write_str("!").unwrap();
- writer.write_str("\n").unwrap();
+impl< 'a > ::askama::Template for HelloTemplate< 'a > {
+ fn render_into(&self, writer: &mut ::std::fmt::Write) -> Result<(), ::std::fmt::Error> {
+ writer.write_str("Hello,")?;
+ writer.write_str(" ")?;
+ writer.write_fmt(format_args!("{}", self.name))?;
+ writer.write_str("!")?;
+ Ok(())
+ }
+}
+impl< 'a > ::std::fmt::Display for HelloTemplate< 'a > {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter) -> Result<(), ::std::fmt::Error> {
+ self.render_into(f)
}
}
```