[−][src]Crate rocket_include_tera
Include Tera Templates for Rocket Framework
This is a crate which provides macros tera_resources_initialize!
and tera_response!
to statically include Tera files from your Rust project and make them be the HTTP response sources quickly.
tera_resources_initialize!
is used in the fairing ofTeraResponseFairing
to include Tera files into your executable binary file. You need to specify each file's name and its path. In order to reduce the compilation time and allow to hot-reload templates, files are compiled into your executable binary file together, only when you are using the release profile.tera_response!
is used for retrieving and rendering the file you input through the macrotera_resources_initialize!
as aTeraResponse
instance with rendered HTML. When itsrespond_to
method is called, three HTTP headers, Content-Type, Content-Length and Etag, will be automatically added, and the rendered HTML can optionally not be minified.tera_response_cache!
is used for wrapping aTeraResponse
and its constructor, and use a key to cache its HTML and ETag in memory. The cache is generated only when you are using the release profile.
See examples
.
Re-exports
pub extern crate tera; |
Macros
tera_resources_initialize | Used in the fairing of |
tera_response | Used for retrieving and rendering the file you input through the macro |
tera_response_cache | Used for wrapping a |
Structs
ReloadableTera | Reloadable Tera. |
TeraContextManager | To monitor the state of Tera. |
TeraResponse | To respond HTML from Tera templates. |