pub struct InputReplay { /* private fields */ }Expand description
A fresh ordered replay cursor. It has no operating-system access.
Implementations§
Source§impl InputReplay
impl InputReplay
Sourcepub fn new(inputs: RecordedInputs) -> Result<Self, HostError>
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.
Sourcepub fn request(
&self,
request: &InputRequest,
) -> Result<InputResponse, HostError>
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.
Trait Implementations§
Source§impl Debug for InputReplay
impl Debug for InputReplay
Source§impl Host for InputReplay
impl Host for InputReplay
Source§fn input(
&self,
request: &InputRequest,
) -> Option<Result<InputResponse, HostError>>
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>
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>
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 moreSource§fn check_tlc_access(&self, _key: &str, _write: bool) -> Result<(), HostError>
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>>
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>
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 moreSource§fn check_register_access(&self) -> Result<(), HostError>
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 moreSource§fn check_action_composition(&self) -> Result<(), HostError>
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
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>
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
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>
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>
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 moreSource§fn request_exit(&self) -> bool
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
impl InputSource for InputReplay
Source§fn request(&self, request: &InputRequest) -> Result<InputResponse, HostError>
fn request(&self, request: &InputRequest) -> Result<InputResponse, HostError>
Executes or replays one exact source request. Read more
Source§fn finish_binding(&self) -> Result<(), HostError>
fn finish_binding(&self) -> Result<(), HostError>
Closes binding and checks all required source demand. Read more
Source§fn recorded(&self) -> RecordedInputs
fn recorded(&self) -> RecordedInputs
Captured assumptions as raw text, never evaluator-owned values.
Auto Trait Implementations§
impl !Freeze for InputReplay
impl Forget for InputReplay
impl Move for InputReplay
impl RefUnwindSafe for InputReplay
impl Send for InputReplay
impl Sync for InputReplay
impl Unpin for InputReplay
impl UnsafeUnpin for InputReplay
impl UnwindSafe for InputReplay
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more