[][src]Trait gtmpl_helpers::THelper

pub trait THelper: Sized {
    fn push_helper(
        self,
        fname: &str,
        f: fn(_: &[Value]) -> Result<Value, String>
    ) -> Self;
fn render_me(&self, c: &Context) -> Result<String, String>; fn q_render<V: Into<Value>>(&self, v: V) -> Result<String, String> { ... }
fn with_math(self) -> Self { ... }
fn with_range(self) -> Self { ... }
fn with_select(self) -> Self { ... }
fn with_string(self) -> Self { ... }
fn with_svg(self) -> Self { ... }
fn with_all(self) -> Self { ... }
fn with_defaults(self) -> Self { ... }
fn with_exec(self) -> Self { ... } }

This trait exists to give methods to the Template object directly. It is not intended to be applied to anything else. By "use"ing this trait, you gain the ability to write "with_svg()" or "with_all() and gain the appropriate helpers for your template q_render is also included to make it slightly easier to render a template. Rather than having to perform Context::from().unwrap() yourself

Required methods

fn push_helper(
    self,
    fname: &str,
    f: fn(_: &[Value]) -> Result<Value, String>
) -> Self

fn render_me(&self, c: &Context) -> Result<String, String>

Loading content...

Provided methods

fn q_render<V: Into<Value>>(&self, v: V) -> Result<String, String>

fn with_math(self) -> Self

fn with_range(self) -> Self

fn with_select(self) -> Self

fn with_string(self) -> Self

fn with_svg(self) -> Self

fn with_all(self) -> Self

👎 Deprecated since 0.1.2:

please use with_defaults instead

fn with_defaults(self) -> Self

fn with_exec(self) -> Self

This is not included in the "with_defaults" option to make sure you know you have added it, as it would be dangerous to use in any web facing programs

Loading content...

Implementations on Foreign Types

impl THelper for Template[src]

Loading content...

Implementors

Loading content...