Skip to main content

render

Function render 

Source
pub fn render(
    template: &Path,
    source: &str,
    suffix: &str,
    context: &impl Serialize,
) -> Result<Served, ServeError>
Available on crate feature served only.
Expand description

Render one template with context, and read the target path, name, and mode it declares.

template names the template, usually its path relative to the repository. Its file name minus suffix is the default target name.

ยงErrors

Returns a ServeError in any of these cases:

  • the file name does not end in suffix;
  • the template does not parse or render;
  • its declarations do not fit the schema, such as a path outside the repository, a name that is not one file name, or a wrongly typed value.