gtmpl 0.2.2

The Golang Templating Language for Rust
Documentation

gtmpl-rust   Build Status Latest Version

The Golang Templating Language for Rust


[dependencies]
gtmpl = "0.2.2"

Current Limitations

This is work in progress. Currently the following features are not supported:

  • complex numbers
  • the following functions have not been implemented:
    • html, js
  • printf is not yet fully stable, but should support all sane input

Usage

Basic template rendering can be achieved in a single line.

extern crate gtmpl;
use gtmpl;

fn basic_template_rendering() {
    let output = gtmpl::template("Finally! Some {{ . }} for Rust", "gtmpl");
    assert_eq!(&output.unwrap(), "Finally! Some gtmpl for Rust");
}

For more examples please take a look at the gtmpl documentation.

Context

We use gtmpl_value's Value as internal data type. gtmpl_derive provides a handy derive marco to generate the From implmentation for Value.

See:

Why do we need this?

The main motivation for this is to make it easier to write dev-ops tools in Rust which feel native. Docker and Helm (Kubernetes) use golang templating and feels more native if tooling around them uses the same.