pub struct LabSession<M: Model> { /* private fields */ }Expand description
Active FrankenLab session wrapping a ProgramSimulator.
Provides deterministic time injection, structured event logging, and
frame-checksum recording. All operations are logged to JSONL via the
underlying TestJsonlLogger.
Implementations§
Source§impl<M: Model> LabSession<M>
impl<M: Model> LabSession<M>
Sourcepub fn init(&mut self)
pub fn init(&mut self)
Initialize the model (calls Model::init()).
Should be called once before injecting events or capturing frames.
Sourcepub fn inject_event(&mut self, event: Event)
pub fn inject_event(&mut self, event: Event)
Inject a terminal event into the model.
Sourcepub fn inject_events(&mut self, events: &[Event])
pub fn inject_events(&mut self, events: &[Event])
Inject multiple terminal events in order.
Sourcepub fn tick(&mut self)
pub fn tick(&mut self)
Simulate a tick event (deterministic time advance).
Injects Event::Tick into the model. The deterministic clock advances
by time_step_ms for each call to now_ms().
Sourcepub fn capture_frame(&mut self) -> &Buffer
pub fn capture_frame(&mut self) -> &Buffer
Capture the current frame at the configured viewport dimensions.
Records a checksum for replay verification and optionally logs it to JSONL.
Sourcepub fn capture_frame_at(&mut self, width: u16, height: u16) -> &Buffer
pub fn capture_frame_at(&mut self, width: u16, height: u16) -> &Buffer
Capture a frame at custom dimensions (overriding the configured viewport).
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the simulated program is still running.
Sourcepub fn frame_records(&self) -> &[FrameRecord]
pub fn frame_records(&self) -> &[FrameRecord]
Get all frame checksum records.
Sourcepub fn event_log(&self) -> &[EventRecord]
pub fn event_log(&self) -> &[EventRecord]
Get all event records (for ordering verification).
Sourcepub fn tick_count(&self) -> u64
pub fn tick_count(&self) -> u64
Number of ticks injected.
Sourcepub fn anomaly_count(&self) -> u64
pub fn anomaly_count(&self) -> u64
Number of scheduling anomalies detected.
Sourcepub fn last_frame(&self) -> Option<&Buffer>
pub fn last_frame(&self) -> Option<&Buffer>
Most recently captured frame.
Sourcepub fn command_log(&self) -> &[CmdRecord]
pub fn command_log(&self) -> &[CmdRecord]
Underlying simulator command log.
Sourcepub fn pool(&self) -> &GraphemePool
pub fn pool(&self) -> &GraphemePool
Access the grapheme pool for text extraction.