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.

Enable handlebars strict mode

By default, handlebars renders empty string for value that undefined or never exists. Since rust is a static type language, we offer strict mode in handlebars-rust. In strict mode, if you were access a value that doesn't exist, a RenderError will be raised.

Return strict mode state, default is false.

By default, handlebars renders empty string for value that undefined or never exists. Since rust is a static type language, we offer strict mode in handlebars-rust. In strict mode, if you were access a value that doesn't exist, a RenderError will be raised.

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 a directory

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 serde::Serialize

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

Trait Implementations

impl Debug for Registry
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Handlebars

impl Sync for Handlebars