From 0129365d1e13ec2d80945f263dcf06a022af7592 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 6 Sep 2017 20:03:22 +0200 Subject: Add documentation on optional features --- askama/src/lib.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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` 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` 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] -- cgit