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]

[src]

[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.

[src]

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.

[src]

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.

[src]

Register a template string

Returns TemplateError if there is syntax error on parsing template.

[src]

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.

[src]

Register a template from a path

[src]

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

[src]

remove a template from the registry

[src]

register a helper

[src]

register a decorator

[src]

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

[src]

Restore the default escape fn.

[src]

Get a reference to the current escape fn.

[src]

Return a registered template,

[src]

Return a registered helper

[src]

Return a registered directive, aka decorator

[src]

Return all templates registered

[src]

Unregister all templates

[src]

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

[src]

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

[src]

render a template string using current registry without register it

[src]

render a template string using current registry without register it

[src]

render a template source using current registry without register it

Trait Implementations

impl Debug for Registry
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Handlebars

impl Sync for Handlebars