Skip to main content

render_to_bytes

Function render_to_bytes 

Source
pub fn render_to_bytes(
    contents: &[u8],
    rel_path: &Path,
    context: &TemplateContext,
) -> Result<Vec<u8>>
Expand description

Render embedded template content to bytes.

If rel_path ends with .tera, the content is rendered through Tera; otherwise it is returned verbatim. Binary files (images, fonts) are always returned as-is.

ยงErrors

Returns an error when the template fails to render.