Struct handlebars::Handlebars [] [src]

pub struct Handlebars { /* fields omitted */ }

The single entry point of your Handlebars templates

It maintains compiled templates and registered helpers.

Methods

impl Registry
[src]

Enable handlebars template source map

Source map provides line/col reporting on error. It uses slightly more memory to maintain the data.

Default is true.

Register a template string

Returns TemplateError if there is syntax error on parsing template.

Register a partial string

A named partial will be added to the registry. It will overwrite template with same name. Currently registered partial is just identical to template.

Register a template from a path

Register a template from std::io::Read source

remove a template from the registry

register a helper

register a decorator

Register a new escape fn to be used from now on by this registry.

Restore the default escape fn.

Get a reference to the current escape fn.

Return a registered template,

Return a registered helper

Return a registered directive, aka decorator

Return all templates registered

Unregister all templates

Render a registered template with some data into a string

  • name is the template name you registred previously
  • ctx is the data that implements ToJson of either rustc_serialize or serde_json

Returns rendered string or an struct with error information

Render a registered template and write some data to the std::io::Write

render a template string using current registry without register it

render a template string using current registry without register it

render a template source using current registry without register it