logo
pub struct RenderContext<'reg, 'rc> { /* private fields */ }
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.

Get the modified context data if any

Set new context data into the render process. This is typically called in decorators where user can modify the data they were rendering.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts self into a collection.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more