pub struct ResponseAssembler { /* private fields */ }Expand description
Turns raw run events into ordered response text. See the module docs.
Implementations§
Source§impl ResponseAssembler
impl ResponseAssembler
Sourcepub fn pass_through_unreferenced(self, enabled: bool) -> Self
pub fn pass_through_unreferenced(self, enabled: bool) -> Self
Forward chunks that no template references (and child-frame chunks) verbatim.
Sourcepub fn include_end(self, enabled: bool) -> Self
pub fn include_end(self, enabled: bool) -> Self
Also render end nodes (their outputs joined by newlines).
Sourcepub fn with_value(self, selector: &Selector, value: Value) -> Self
pub fn with_value(self, selector: &Selector, value: Value) -> Self
Provide a value for a non-node variable such as sys.query.
Sourcepub fn with_pool(self, pool: VariablePool) -> Self
pub fn with_pool(self, pool: VariablePool) -> Self
Provide non-node variables in bulk (e.g. the run’s sys / conversation values).
Sourcepub fn resume_from(self, snapshot: &FrameSnapshot) -> Self
pub fn resume_from(self, snapshot: &FrameSnapshot) -> Self
Continue assembling a resumed run from the root frame snapshot carried by
RunPaused (snapshot.root).
Restores every variable value of the snapshot (node outputs included, so templates can reference nodes that will not run again), node and edge states (for correct ordering), and marks response nodes that already succeeded before the pause as rendered, so they are not emitted twice. A response that was only partially rendered when the run paused is rendered again from the start.
Sourcepub fn text_so_far(&self) -> &str
pub fn text_so_far(&self) -> &str
All response text emitted so far, concatenated.
Sourcepub fn push(&mut self, event: &Event) -> Vec<ResponseChunk>
pub fn push(&mut self, event: &Event) -> Vec<ResponseChunk>
Feed one event; returns the response chunks it unlocks.
Sourcepub fn finish(&mut self) -> Vec<ResponseChunk>
pub fn finish(&mut self) -> Vec<ResponseChunk>
Flush: treat every pending variable as resolved and render what is available. Idempotent.