pub trait THelper: Sized {
// Required methods
fn push_helper(
self,
fname: &str,
f: fn(&[Value]) -> Result<Value, String>,
) -> Self;
fn render_me(&self, c: &Context) -> Result<String, String>;
// 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 { ... }
fn with_defaults(self) -> Self { ... }
fn with_exec(self) -> Self { ... }
}
Expand description
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>
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
insteadfn with_defaults(self) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.