aboutsummaryrefslogtreecommitdiffstats
path: root/README.rst
diff options
context:
space:
mode:
Diffstat (limited to 'README.rst')
-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.