Struct bracket::render::Render[][src]

pub struct Render<'render> { /* fields omitted */ }
Expand description

Render a template.

Implementations

Create a renderer.

You should not need to create a renderer directly, instead use the functions provided by the Registry.

Get the name of the template being rendered.

This will equal the name given when the renderer is started and does not account for partials; to get the name of a template including the current partial use current_name().

Get the current name for the template being rendered.

When a partial is being rendered this will return the name for the current partial otherwise it falls back to the name given when the renderer was started.

When partials have been loaded from the file system the name will be the file path and should be safe to pass to PathBuf::from to get a reference to the original file.

It is the caller’s responsiblity to account for relative paths when converting template names to paths.

Render template string content and return the buffered result.

The current call site stack is cloned and used in a new render pass so that cyclic calls can be detected before the stack overflows.

Use this function when a helper wants to render a dynamic template but needs to prevent a stack overflow when a cyclic call is detected.

Get a reference to the registry.

Render a node by iterating it’s children.

The supplied node should be a document or block node.

Get a named template.

Get a mutable reference to the output destination.

You should prefer the write() and write_escaped() functions when writing strings but if you want to write bytes directly to the output destination you can use this reference.

Escape a value using the current escape function.

Write a string to the output destination.

Write a string to the output destination and escape the content using the current escape function.

Push a scope onto the stack.

Remove a scope from the stack.

Get a mutable reference to the current scope.

Reference to the root data for the render.

Evaluate the block conditionals and find the first node that should be rendered.

Render an inner template.

Block helpers should call this when they want to render an inner template.

Render a node and buffer the result to a string.

The call stack and scopes are inherited from this renderer.

The supplied node should be a document or block node.

Evaluate a path and return the resolved value.

This allows helpers to find variables in the template data using the familiar path syntax such as @root.name.

Paths are evaluated using the current scope so local variables in the current scope will be resolved.

Paths are dynamically evaluated so syntax errors are caught and returned wrapped as HelperError.

Sub-expressions are not executed.

Evaluate a path and perform a type assertion on the value.

If no value exists for the given path the value is treated as null and type assertion is performed on the null value.

Register a local helper.

Local helpers are available for the scope of the parent helper.

Remove a local helper.

Local helpers will be removed once a helper call has finished but you can call this if you want to be explicit.

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

Performs the conversion.

Performs the conversion.

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.