lib-humus 0.5.0

Helps creating configurable frontends for humans and computers using axum, Tera and toml.
#![warn(missing_docs)]
#![allow(clippy::needless_return)] // Explicit returning can improve readability
#![allow(clippy::result_unit_err)] // Better than uing an Option …
#![allow(clippy::to_string_trait_impl)] // Don't want to deal with reimplmenting as `Display` right now.
#![allow(clippy::redundant_field_names)] // Those are okay
#![allow(clippy::tabs_in_doc_comments)] // Tabs are just fine
#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg))]

//! 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][HumusView]
//! 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].
//!
//! This library is derived from (and now used by) the
//! [echoip-slatecave service](https://codeberg.org/slatian/service.echoip-slatecave).
//!
//! # Feature-flags
//!
//! Features enabled by default:
//! * `axum-view`: Provides the [HumusEngine] and sourrounding utilities
//! * `tera-loader`: Provides the [TemplateEngineLoader].
//!
//! Features disabled by default:
//! * `axum-view+cookie`: Provides the [HumusView::get_cookie_header] helper for setting cookies.

///////////////////////////////////////
// Tera-Loader

#[cfg(feature = "tera-loader")]
mod template_loader;

#[cfg(feature = "tera-loader")]
pub use self::template_loader::*;

///////////////////////////////////////
// Proto Engine

#[cfg(any(feature = "tera-loader", feature = "axum-view"))]
mod proto_engine;

#[cfg(any(feature = "tera-loader", feature = "axum-view"))]
pub use self::proto_engine::HumusProtoEngine;

///////////////////////////////////////
// Axum-View

#[cfg(feature = "axum-view")]
mod engine;
#[cfg(feature = "axum-view")]
mod format;
#[cfg(feature = "axum-view")]
mod query_settings;
#[cfg(feature = "axum-view")]
mod view;

#[cfg(feature = "axum-view")]
pub use self::{engine::*, format::*, query_settings::*, view::*};