Skip to main content

InputReplay

Struct InputReplay 

Source
pub struct InputReplay { /* private fields */ }
Expand description

A fresh ordered replay cursor. It has no operating-system access.

Implementations§

Source§

impl InputReplay

Source

pub fn new(inputs: RecordedInputs) -> Result<Self, HostError>

Starts an independent cursor over explicit, bounded assumptions.

use dive_eval::inputs::{HostAccess, InputRecord, InputReplay,
    InputRequest, InputResponse, RecordedInputs};
let request = InputRequest::TextFile("input.txt".into());
let replay = InputReplay::new(RecordedInputs {
    grants: HostAccess::parse("files").unwrap(),
    records: vec![InputRecord { request: request.clone(),
        response: InputResponse::Text("hello".into()) }],
}).unwrap();
assert_eq!(replay.request(&request).unwrap(), InputResponse::Text("hello".into()));
replay.finish_binding().unwrap();
§Errors

Invalid recorded inputs; no source or host callback is executed.

Source

pub fn request( &self, request: &InputRequest, ) -> Result<InputResponse, HostError>

Consumes the next exact source operation/argument pair.

§Errors

Missing, mismatched, extra-phase or previously failed input requests.

Source

pub fn finish_binding(&self) -> Result<(), HostError>

Closes binding, requiring every supplied record to have been demanded.

§Errors

A latched replay failure or extra input records.

Source

pub fn failure(&self) -> Option<HostError>

A latched mismatch or request outside binding, even if source caught it.

Trait Implementations§

Source§

impl Debug for InputReplay

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Host for InputReplay

Source§

fn input( &self, request: &InputRequest, ) -> Option<Result<InputResponse, HostError>>

Supplies raw external inputs after explicit evaluator category admission. No implementation is supplied by default; independent replay hosts must consume an explicit recorded context and never read the operating system.
Source§

fn check_native_access(&self, _op: StdOp) -> Result<(), HostError>

Checks a native operation at runtime, before its arguments or body run. Ordinary evaluators permit it; an isolated driver may remember a refusal even if startup binding later catches the evaluation error. Read more
Source§

fn print_output(&self, _text: &str) -> Result<bool, HostError>

Checks a rendered Print/PrintT event before any output sink is called. Arguments and rendering have already been evaluated. false preserves the operator’s return value while discarding replay output; true emits the event. Ordinary hosts keep the existing output behavior. Read more
Source§

fn check_tlc_access(&self, _key: &str, _write: bool) -> Result<(), HostError>

Checks a string TLCGet/TLCSet key before accessing host state. Read more
Source§

fn random( &self, _op: StdOp, _args: &[Value], _ctx: Ctx, ) -> Option<Result<Value, HostError>>

Applies a random operator (RandomElement, RandomSubset, RandomSetOfSubsets) to its evaluated arguments, drawing from the stream of the current evaluation: TLC’s start-up stream during constant definitions, ASSUMEs and Init, and the stream reseeded from the expanded state’s fingerprint while expanding a state. None when the host has no stream.
Source§

fn check_random_in_enabled(&self) -> Result<(), HostError>

Checks a random operation reached inside an ENABLED query, before evaluating its arguments. Ordinary hosts retain TLC’s behavior. Isolated sampling/replay hosts may refuse until they can prove the query’s full random support, including a negative existential result. Read more
Source§

fn check_register_access(&self) -> Result<(), HostError>

Checks whether this run permits access to the evaluator’s register file. Called before integer/named TLCGet reads, aggregate register reads ("all", "all:named"), and integer/named TLCSet writes. Other introspection keys do not call this method. The default permits access, preserving ordinary evaluator and checker behavior. Read more
Source§

fn check_action_composition(&self) -> Result<(), HostError>

Checks whether expression evaluation or successor generation may search intermediate states to decide unrestricted action composition. Independent replay refuses this; its explicit bounded capability is checked separately. Read more
Source§

fn requires_bounded_action_composition(&self) -> bool

Selects the evaluator’s bounded, pure TLA+ composition path. Read more
Source§

fn check_bounded_action_composition(&self) -> Result<(), HostError>

Checks the host’s permission for an inspected bounded composition. Existing host refusals still apply unless the host explicitly admits this slice. This is called before collecting any intermediate states. Read more
Source§

fn expression_cache_domain(&self) -> u64

The cache domain that lazy expression results computed under this host belong to. A cached result is reused only by evaluation under a host of the same domain. Ordinary drivers share domain 0 (TLC’s single LazyValue cache). Independent replay gives each run its own domain, so a value cached by another consumer never becomes replay’s answer and a replay verdict does not depend on how warm the caches were.
Source§

fn level(&self) -> Option<i64>

TLCGet("level") outside ASSUME and Init: the level of TLC’s s0, the state being expanded in the next-state relation and action checks, the successor in invariants and constraints (initial states are level 1).
Source§

fn successor_level(&self) -> Result<i64, HostError>

TLCGet("level") under a prime. TLC evaluates a primed expression with the successor as its current state, so it reads the successor’s level, which Self::level does not describe. No host tracks it, so the default refuses by name; a host may remember the refusal so that a verdict built around a swallowed error is refused too. Read more
Source§

fn counter(&self, _counter: Counter) -> Option<i64>

A live counter.
Source§

fn config(&self) -> Option<RunConfig>

TLCGet("config").
Source§

fn request_exit(&self) -> bool

TLCSet("exit", TRUE): ends the run as a success once the current state is done (ModelChecker.stop). Returns whether the host acts on it.
Source§

impl InputSource for InputReplay

Source§

fn request(&self, request: &InputRequest) -> Result<InputResponse, HostError>

Executes or replays one exact source request. Read more
Source§

fn finish_binding(&self) -> Result<(), HostError>

Closes binding and checks all required source demand. Read more
Source§

fn recorded(&self) -> RecordedInputs

Captured assumptions as raw text, never evaluator-owned values.

Auto Trait Implementations§

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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.