Skip to main content

LabSession

Struct LabSession 

Source
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>

Source

pub fn init(&mut self)

Initialize the model (calls Model::init()).

Should be called once before injecting events or capturing frames.

Source

pub fn send(&mut self, msg: M::Message)

Send a message directly to the model.

Source

pub fn inject_event(&mut self, event: Event)

Inject a terminal event into the model.

Source

pub fn inject_events(&mut self, events: &[Event])

Inject multiple terminal events in order.

Source

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().

Source

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.

Source

pub fn capture_frame_at(&mut self, width: u16, height: u16) -> &Buffer

Capture a frame at custom dimensions (overriding the configured viewport).

Source

pub fn model(&self) -> &M

Access the underlying model.

Source

pub fn model_mut(&mut self) -> &mut M

Access the underlying model mutably.

Source

pub fn is_running(&self) -> bool

Check if the simulated program is still running.

Source

pub fn frame_records(&self) -> &[FrameRecord]

Get all frame checksum records.

Source

pub fn event_log(&self) -> &[EventRecord]

Get all event records (for ordering verification).

Source

pub fn tick_count(&self) -> u64

Number of ticks injected.

Source

pub fn anomaly_count(&self) -> u64

Number of scheduling anomalies detected.

Source

pub fn frames(&self) -> &[Buffer]

All captured frame buffers.

Source

pub fn last_frame(&self) -> Option<&Buffer>

Most recently captured frame.

Source

pub fn logs(&self) -> &[String]

Logs emitted via Cmd::Log.

Source

pub fn command_log(&self) -> &[CmdRecord]

Underlying simulator command log.

Source

pub fn pool(&self) -> &GraphemePool

Access the grapheme pool for text extraction.

Source

pub fn now_ms(&self) -> u64

Deterministic monotonic time from the fixture.

Source

pub fn log_info(&self, event: &str, fields: &[(&str, JsonValue)])

Log a custom info event via the JSONL logger.

Source

pub fn log_warn(&self, anomaly: &str, detail: &str)

Log a warning (scheduling anomaly or custom) event.

Auto Trait Implementations§

§

impl<M> !Freeze for LabSession<M>

§

impl<M> !RefUnwindSafe for LabSession<M>

§

impl<M> Send for LabSession<M>
where M: Send,

§

impl<M> Sync for LabSession<M>
where M: Sync,

§

impl<M> Unpin for LabSession<M>
where M: Unpin,

§

impl<M> UnsafeUnpin for LabSession<M>
where M: UnsafeUnpin,

§

impl<M> !UnwindSafe for LabSession<M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more