boilerplate
boilerplate
is a minimal Rust text template engine with no runtime
dependencies.
boilerplate
uses Rust as the template language, so all templates are checked
for errors at compile time, and any Rust type that implements Display
can be
used in a template context.
Add boilerplate
to your project's Cargo.toml
:
toml
[dependencies]
boilerplate = "*"
Create a template in templates/my-template.txt
:
text
Foo is {{self.n}}!
Define, instantiate, and render the template context:
```rust use boilerplate::Boilerplate;
struct MyTemplate { n: u32, }
asserteq!(MyTemplate { n: 10 }.tostring(), "Foo is 10!\n"); ```
See the docs for more information and examples.