Struct handlebars::RenderContext [−][src]
pub struct RenderContext<'reg, 'rc> { /* fields omitted */ }
Expand description
The context of a render call
This context stores information of a render and a writer where generated content is written to.
Implementations
Create a render context from a Write
Push a block context into render context stack. This is typically called when you entering a block scope.
Pop and drop current block context. This is typically called when leaving a block scope.
Borrow a reference to current block context
Borrow a mutable reference to current block context in order to modify some data.
Set new context data into the render process. This is typically called in decorators where user can modify the data they were rendering.
pub fn evaluate(
&self,
context: &'rc Context,
relative_path: &str
) -> Result<ScopedJson<'reg, 'rc>, RenderError>
pub fn evaluate(
&self,
context: &'rc Context,
relative_path: &str
) -> Result<ScopedJson<'reg, 'rc>, RenderError>
Evaluate a Json path in current scope.
Typically you don’t need to evaluate it by yourself. The Helper and Decorator API will provide your evaluated value of their parameters and hash data.
Get registered partial in this render context
Register a partial for this context
Remove a registered partial
Test if given template name is current template.
Register a helper in this render context. This is a feature provided by Decorator where you can create temporary helpers.
Remove a helper from render context
Attempt to get a helper from current render context.
Returns the current template name. Note that the name can be vary from root template when you are rendering from partials.
Set the current template name.
Get root template name if any.
This is the template name that you call render
from Handlebars
.
Get the escape toggle
Set the escape toggle. When toggle is on, escape_fn will be called when rendering.
Trait Implementations
Auto Trait Implementations
impl<'reg, 'rc> !RefUnwindSafe for RenderContext<'reg, 'rc>
impl<'reg, 'rc> !Send for RenderContext<'reg, 'rc>
impl<'reg, 'rc> !Sync for RenderContext<'reg, 'rc>
impl<'reg, 'rc> Unpin for RenderContext<'reg, 'rc>
impl<'reg, 'rc> !UnwindSafe for RenderContext<'reg, 'rc>
Blanket Implementations
Mutably borrows from an owned value. Read more