aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-15 21:03:32 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2017-02-15 21:03:32 +0100
commit193de3d264e42bd331b43083085f1ca21af72d39 (patch)
tree097578af23795a0486752e4fb703cc93e3acb378
parent72241bcc422fa9c6bd212f64f3024876cda3e2d7 (diff)
downloadaskama-193de3d264e42bd331b43083085f1ca21af72d39.tar.gz
askama-193de3d264e42bd331b43083085f1ca21af72d39.tar.bz2
askama-193de3d264e42bd331b43083085f1ca21af72d39.zip
Show generated code in README
-rw-r--r--README.rst15
1 files changed, 15 insertions, 0 deletions
diff --git a/README.rst b/README.rst
index 0ada6e9..c776a30 100644
--- a/README.rst
+++ b/README.rst
@@ -95,6 +95,21 @@ In any Rust file inside your crate, add the following:
}
You should now be able to compile and run this code.
+Askama should generate Rust code like below:
+
+.. code-block:: rust
+
+ #[allow(dead_code, non_camel_case_types)]
+ type TemplateFromhello2ehtml<'a> = HelloTemplate<'a>;
+ 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();
+ }
+ }
Review the `test cases`_ for more examples.