diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-09-06 20:03:22 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-09-06 20:03:47 +0200 |
commit | 0129365d1e13ec2d80945f263dcf06a022af7592 (patch) | |
tree | b22c3a42fc8a96c3fd1badd499d19e357ee2021a | |
parent | 60036152a0ab731a90649d153a3fc9c944ac6e8d (diff) | |
download | askama-0129365d1e13ec2d80945f263dcf06a022af7592.tar.gz askama-0129365d1e13ec2d80945f263dcf06a022af7592.tar.bz2 askama-0129365d1e13ec2d80945f263dcf06a022af7592.zip |
Add documentation on optional features
Diffstat (limited to '')
-rw-r--r-- | askama/src/lib.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/askama/src/lib.rs b/askama/src/lib.rs index f73ae41..7ebc5db 100644 --- a/askama/src/lib.rs +++ b/askama/src/lib.rs @@ -219,6 +219,38 @@ //! Expressions can be grouped using parentheses. //! The HTML special characters `&`, `<` and `>` will be replaced with their //! character entities unless the `escape` mode is disabled for a template. +//! +//! # Optional functionality +//! +//! ## Rocket integration +//! +//! Enabling the `with-rocket` feature appends an implementation of Rocket's +//! `Responder` trait for each template type. This makes it easy to trivially +//! return a value of that type in a Rocket handler. See +//! [the example](https://github.com/djc/askama/blob/master/testing/tests/rocket.rs) +//! from the Askama test suite for more on how to integrate. +//! +//! In case a run-time error occurs during templating, a `500 Internal Server +//! Error` `Status` value will be returned, so that this can be further +//! handled by your error catcher. +//! +//! ## Iron integration +//! +//! Enabling the `with-iron` feature appends an implementation of Iron's +//! `Modifier<Response>` trait for each template type. This makes it easy to +//! trivially return a value of that type in an Iron handler. See +//! [the example](https://github.com/djc/askama/blob/master/testing/tests/iron.rs) +//! from the Askama test suite for more on how to integrate. +//! +//! Note that Askama's generated `Modifier<Response>` implementation currently +//! unwraps any run-time errors from the template. If you have a better +//! suggestion, please [file an issue](https://github.com/djc/askama/issues/new). +//! +//! ## The `json` filter +//! +//! Enabling the `serde-json` filter will enable the use of the `json` filter. +//! This will output formatted JSON for any value that implements the required +//! `Serialize` trait. #![allow(unused_imports)] #[macro_use] |