Module template

Module template 

Source
Expand description

The Template type.

Templates are the primary way of describing crate::event::Events. A template is a block of text with named holes for Values to be interpolated into. When the template is fed a set of Props it can be rendered into text using an instance of Write. Here’s an example of a template:

Hello, {user}.

If this template is fed the property user: "Rust", it can be rendered into text:

Hello, Rust.

Templates are conceptually similar to the standard library’s Arguments type. The key difference between them is that templates are a runtime construct rather than a compile time one. You can construct a template programmatically, inspect its holes, and choose to render it in any way you like. The standard library’s formatting APIs are optimized for producing strings. Templates are both a property capturing and a formatting tool.

Structs§

Formatter
A specialized formatter for a Value interpolated into a Part::hole.
Part
An individual token in a Template.
Parts
The result of calling Template::parts.
Render
The result of calling Template::render.
Template
A lazily evaluated text template with named holes for interpolating properties into.

Traits§

Write
A template-aware writer used by Render::write to format a template.