Expand description
lib-humus helps with some fertile ground to build project on.
It helps combining axum with tera and getting configuration from toml-files.
The idea behind this is that all the data that gets rendered as html should also be available as a JSON-API (and other formats if useful). The html should also come from easily replaceable templates that are themselves configurable.
The HumusEngine helps you with that, it gets handed a serde seralizable View and some HumusQuerySettings and then generates an appropriate response. (How you generate those is currently completely up to you.)
Loading the templates and the template configuration can be done using the TemplateEngineLoader.
And since you probably need configurtion for your own application the read_toml_from_file function is exported for public use.
This library is derived from (and now used by) the echoip-slatecave service.
§Feature-flags
Features enabled by default:
axum-view
: Provides the HumusEngine and sourrounding utilitiestera-loader
: Provides the TemplateEngineLoader.toml
Provides the read_toml_from_file helper.
Features disabled by default:
axum-view+cookie
: Provides the HumusView::get_cookie_header helper for setting cookies.
Structs§
- Humus
Engine axum-view
- 🌄 Tera based Templating Engine that writes out axum Response structs.
- Humus
Proto Engine tera-loader
oraxum-view
- A constructable version of HumusEngine without the types attached.
- Template
Engine Loader tera-loader
- Helps loading Templates from disk along with a handy configuration file.
Enums§
- Html
Text Json Format axum-view
- Ready to use example implementation of a HumusFormat
featuring
html
,text
andjson
. - Humus
Format Family axum-view
- Defines how the response should be rendered.
- Template
Engine Loader Error tera-loader
- Returned when loading a template using the TemplateEngineLoader fails.
- Toml
Error toml
- Returned when read_toml_from_file() fails.
Traits§
- Humus
Format axum-view
- Provides information on what to render and how to deliver it to the HumusEngine.
- Humus
Query Settings axum-view
- Provides context from the query for use in the HumusEngine.
- Humus
View axum-view
- 👁 Provides data and logic for the HumusEngine and knows how to put information together.
Functions§
- read_
toml_ from_ file toml
- Reads from a specified filepath, parses as toml and returns as the desired deserialized type.