Crate lib_humus

source ·
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:

Features disabled by default:

Structs§

  • HumusEngineaxum-view
    🌄 Tera based Templating Engine that writes out axum Response structs.
  • HumusProtoEnginetera-loader or axum-view
    A constructable version of HumusEngine without the types attached.
  • Helps loading Templates from disk along with a handy configuration file.

Enums§

Traits§

Functions§

  • Reads from a specified filepath, parses as toml and returns as the desired deserialized type.