Crate templr

Source

Re-exports§

pub use attrs::Attribute;
pub use attrs::Attributes;
pub use attrs::OptAttrValue;
pub use anyhow;

Modules§

attrs

Macros§

attrs
This renders the attributes into a PrerenderedAttrs struct. This can later be used for attributes instantiation.
templ
The templ! macro compiles down your template to an FnTemplate closure. It uses HTML like syntax to write templates, except:
templ_ret
Return type for functions that return templ! { ... }. This takes a lifetime (defaults to 'static) and a context type (defaults to ()).

Structs§

Error
The Error type, a wrapper around a dynamic error type.
FnTemplate
A wrapper for the render_with_children_into closure that implements Template.
Response
A response struct that implements the various frameworks’ response traits
Trust
Trust content and don’t escape it when interpolated in templates.

Traits§

Escapable
Mostly like Display, but with a DONT_ESCAPE flag.
Template
Main template trait. An implementation can be generated using the templ! macro.
TemplateExt
Extension trait for generating a response
ToTemplate
A trait to convert a type to a Template. Used when deriving Template.

Functions§

write_escaped
Writes html-escaped value into writer.

Type Aliases§

Result
Result<T, Error>

Derive Macros§

Template
This derives the Template trait using all ToTemplate implementations. This implementation runs ToTemplate::to_template for every method of the Template trait, so that method should be very lightweight (like using templ!).