Incrust is a template engine written in Rust, inspired by Jinja2.
The implementation is at a very early stage.
Incrust is available on crates.io and can be included in your Cargo enabled project like this:
[dependencies]
incrust = "0.0"
Then include it in your code like this:
rust
extern crate incrust;
```rust use incrust::Incrust;
fn main() { let incrust = Incrust::new(); let tpl = incrust.parse("
Visible {# partially #} paragraph
").unwrap(); let result = incrust.renderparsed(tpl, hashmap!{}).unwrap(); asserteq!(result, "Visible paragraph
"); } ``````rust use incrust::Incrust;
fn main() { let incrust = Incrust::new(); let result = incrust.rendertext("Hello, {{name}}!", hashmap!{ "name" => "World", }).unwrap(); asserteq!(result, "Hello, World!"); } ```
```rust use incrust::Incrust;
fn main() {
let incrust = Incrust::new();
let result = incrust.rendertext("{{ text | e }}
", hashmap!{ "text" => "
Licensed under either of * Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) * MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.