pub struct Session { /* private fields */ }Expand description
A persistent session for incremental sentence evaluation.
Maintains discourse state across multiple eval() calls, enabling
cross-sentence anaphora resolution and temporal ordering.
Implementations§
Source§impl Session
impl Session
Sourcepub fn set_format(&mut self, format: OutputFormat)
pub fn set_format(&mut self, format: OutputFormat)
Switch the output format mid-session.
Affects only how subsequent sentences are rendered; discourse state (referents, event counters) is untouched, so a session switched to LaTeX renders exactly as one that used LaTeX from the start.
Sourcepub fn with_format(format: OutputFormat) -> Self
pub fn with_format(format: OutputFormat) -> Self
Create a new session with a specific output format.
Sourcepub fn eval(&mut self, input: &str) -> Result<String, ParseError>
pub fn eval(&mut self, input: &str) -> Result<String, ParseError>
Evaluate a single sentence, updating the session state.
Returns the transpiled logic for just this sentence. Pronouns in this sentence can resolve to entities from previous sentences.
Sourcepub fn history(&self) -> String
pub fn history(&self) -> String
Get the full accumulated logic from all sentences.
Includes temporal ordering constraints (Precedes relations).
Sourcepub fn turn_count(&self) -> usize
pub fn turn_count(&self) -> usize
Get the number of sentences processed.
Sourcepub fn world_state(&self) -> &WorldState
pub fn world_state(&self) -> &WorldState
Get direct access to the world state (for advanced use).
Sourcepub fn world_state_mut(&mut self) -> &mut WorldState
pub fn world_state_mut(&mut self) -> &mut WorldState
Get mutable access to the world state (for advanced use).