Crates.io | rocket-include-tera |
lib.rs | rocket-include-tera |
version | 0.5.8 |
source | src |
created_at | 2019-05-24 06:22:16.802699 |
updated_at | 2023-12-15 03:32:17.923257 |
description | 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. |
homepage | https://magiclen.org/rocket-include-tera |
repository | https://github.com/magiclen/rocket-include-tera |
max_upload_size | |
id | 136562 |
size | 88,224 |
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 of TeraResponseFairing
to include Tera files into your executable binary file. You need to specify each file's name and its path relative to the directory containing the manifest of your package. 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 macro tera_resources_initialize!
as a TeraResponse
instance with rendered HTML. When its respond_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 a TeraResponse
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.tera_resources_initializer!
is used for generating a fairing for tera resources.See examples
.
https://crates.io/crates/rocket-include-tera
https://docs.rs/rocket-include-tera