Skip to content

Commit 0129365

Browse files
committed
Add documentation on optional features
1 parent 6003615 commit 0129365

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

askama/src/lib.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,38 @@
219219
//! Expressions can be grouped using parentheses.
220220
//! The HTML special characters `&`, `<` and `>` will be replaced with their
221221
//! character entities unless the `escape` mode is disabled for a template.
222+
//!
223+
//! # Optional functionality
224+
//!
225+
//! ## Rocket integration
226+
//!
227+
//! Enabling the `with-rocket` feature appends an implementation of Rocket's
228+
//! `Responder` trait for each template type. This makes it easy to trivially
229+
//! return a value of that type in a Rocket handler. See
230+
//! [the example](https://github.com/djc/askama/blob/master/testing/tests/rocket.rs)
231+
//! from the Askama test suite for more on how to integrate.
232+
//!
233+
//! In case a run-time error occurs during templating, a `500 Internal Server
234+
//! Error` `Status` value will be returned, so that this can be further
235+
//! handled by your error catcher.
236+
//!
237+
//! ## Iron integration
238+
//!
239+
//! Enabling the `with-iron` feature appends an implementation of Iron's
240+
//! `Modifier<Response>` trait for each template type. This makes it easy to
241+
//! trivially return a value of that type in an Iron handler. See
242+
//! [the example](https://github.com/djc/askama/blob/master/testing/tests/iron.rs)
243+
//! from the Askama test suite for more on how to integrate.
244+
//!
245+
//! Note that Askama's generated `Modifier<Response>` implementation currently
246+
//! unwraps any run-time errors from the template. If you have a better
247+
//! suggestion, please [file an issue](https://github.com/djc/askama/issues/new).
248+
//!
249+
//! ## The `json` filter
250+
//!
251+
//! Enabling the `serde-json` filter will enable the use of the `json` filter.
252+
//! This will output formatted JSON for any value that implements the required
253+
//! `Serialize` trait.
222254
223255
#![allow(unused_imports)]
224256
#[macro_use]

0 commit comments

Comments
 (0)