From 193de3d264e42bd331b43083085f1ca21af72d39 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 15 Feb 2017 21:03:32 +0100 Subject: Show generated code in README --- README.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'README.rst') 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. -- cgit