pub struct Regeneration { /* private fields */ }Expand description
Everything a regenerate reads before it renders: the item’s own content and provenance, the template, and the answers a render starts from.
Engine::regeneration answers one and Engine::regenerate renders and writes it — the
two halves apart so a caller that asks for answers, as the command line does when
interactive, can ask between them. Engine::render_task, Engine::render_project and
Engine::render_document are the two together.
Implementations§
Source§impl Regeneration
impl Regeneration
Sourcepub fn base(&self) -> &Answers
pub fn base(&self) -> &Answers
The answers a render starts from, before any new ones are laid over them.
Sourcepub fn settled(&self) -> impl Iterator<Item = &str>
pub fn settled(&self) -> impl Iterator<Item = &str>
Every variable the stored answers settle when they are the base — an optional one
they left null included, which a render leaves unanswered again — and none when
they are not.
Sourcepub fn unused(&self) -> Option<&UnusedAnswers>
pub fn unused(&self) -> Option<&UnusedAnswers>
Why the stored answers were not the base, when they were not.
Sourcepub fn render(&self, answers: &Answers) -> Result<RenderedTemplate, EngineError>
pub fn render(&self, answers: &Answers) -> Result<RenderedTemplate, EngineError>
Render from the base with answers laid over it.
A stored answer to a variable the template no longer declares is dropped rather than refused: it was this product’s to keep, not the caller’s to answer for.
§Errors
EngineError::MissingAnswers naming every required variable left unanswered and
why the stored answers were not used; EngineError::Template for any other refusal
of the answers or of the template.