Trait nickel_mustache::TemplateSupport [] [src]

pub trait TemplateSupport {
    type Cache: TemplateCache;
    fn cache(&self) -> Option<&Self::Cache> { ... }
    fn adjust_path<'a>(&self, path: &'a Path) -> Cow<'a, Path> { ... }
    fn adjust_layout_path<'a>(&self, path: &'a Path) -> Cow<'a, Path> { ... }
    fn default_layout(&self) -> Option<Cow<Path>> { ... }
}

Customise the behaviour of the templating system.

Associated Types

type Cache: TemplateCache

What type to dispatch the cache handling to.

Note

Currently if you don't want custom behavior you should use () as your Cache. When 'associated type defaults' becomes stable then this won't be necessary to specify anymore.

Provided Methods

fn cache(&self) -> Option<&Self::Cache>

A reference to the Cache if there is one.

fn adjust_path<'a>(&self, path: &'a Path) -> Cow<'a, Path>

Adjust the path of a template lookup before it gets compiled.

This can be useful if you want to keep a clean directory structure without having to spread that knowledge across your handlers.

See examples/adjusted_path.rs for example usage.

fn adjust_layout_path<'a>(&self, path: &'a Path) -> Cow<'a, Path>

Adjust the path of a layout lookup before it gets compiled.

This can be useful if you want to keep a clean directory structure without having to spread that knowledge across your handlers.

See examples/adjusted_path.rs for example usage.

fn default_layout(&self) -> Option<Cow<Path>>

The default layout to use when rendering.

See examples/default_layout.rs for example usage.

Implementors