pub fn render(
ctx: &Context,
req: RenderRequest,
) -> Result<Outcome<String>, CoreError>Expand description
Render req’s recipe through req’s template.
Aisle and pantry configuration come from ctx, and both
ConfigSource kinds work: a ConfigSource::Path is handed to
cooklang-reports to read, and a ConfigSource::Inline is injected
directly as the aisle_content / pantry_content template variables that
aisled(), excluding_pantry() and from_pantry() look up. The two are
equivalent to a template, with one difference worth knowing: a
ConfigSource::Path naming a file that cannot be read is not an error —
cooklang-reports warns on stderr and carries on as though no aisle or
pantry had been given.
§Errors
CoreError::InvalidScaleif the scale is not finite. Checked before anything is read.CoreError::RecipeNotFoundif aRecipeSource::Pathmatches nothing.CoreError::Ioif such a path matches a file that cannot be read.CoreError::Renderif the template is broken, if rendering it fails, or ifcooklang-reportscould not parse the recipe. Itsrenderedfield carries that crate’s own formatted report, which the CLI prints verbatim.