pub trait Host:
Send
+ Sync
+ Debug {
Show 16 methods
// Provided methods
fn input(
&self,
_request: &InputRequest,
) -> Option<Result<InputResponse, HostError>> { ... }
fn check_native_access(&self, _op: StdOp) -> Result<(), HostError> { ... }
fn print_output(&self, _text: &str) -> Result<bool, HostError> { ... }
fn check_tlc_access(
&self,
_key: &str,
_write: bool,
) -> Result<(), HostError> { ... }
fn random(
&self,
_op: StdOp,
_args: &[Value],
_ctx: Ctx,
) -> Option<Result<Value, HostError>> { ... }
fn check_random_in_enabled(&self) -> Result<(), HostError> { ... }
fn check_register_access(&self) -> Result<(), HostError> { ... }
fn check_action_composition(&self) -> Result<(), HostError> { ... }
fn requires_bounded_action_composition(&self) -> bool { ... }
fn check_bounded_action_composition(&self) -> Result<(), HostError> { ... }
fn expression_cache_domain(&self) -> u64 { ... }
fn level(&self) -> Option<i64> { ... }
fn successor_level(&self) -> Result<i64, HostError> { ... }
fn counter(&self, _counter: Counter) -> Option<i64> { ... }
fn config(&self) -> Option<RunConfig> { ... }
fn request_exit(&self) -> bool { ... }
}Expand description
The run hosting the evaluator: the model checker (or another driver).
Every method has a default that provides nothing; an operator that needs what a host does not provide is refused by name.
Parallel engines. The methods take &self and are called from the
thread that evaluates. A host whose answers differ per worker (the level
of the state being expanded, the random stream) keeps them per thread.
Provided Methods§
Sourcefn 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.
Sourcefn 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.
§Errors
A named refusal or a host evaluation error.
Sourcefn 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.
§Errors
A named refusal or an output resource bound. Rendering’s temporary allocation is not bounded by this hook.
Sourcefn 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.
§Errors
A named refusal or a host evaluation error.
Sourcefn 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.
Sourcefn 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.
§Errors
A named refusal or a host evaluation error.
Sourcefn 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.
§Errors
A host may refuse search-dependent register access (code 0) or provide a TLC evaluation error. Refusal occurs before reading or writing.
Sourcefn 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.
§Errors
A refusal (code 0) or an evaluation error supplied by the driver.
Sourcefn requires_bounded_action_composition(&self) -> bool
fn requires_bounded_action_composition(&self) -> bool
Selects the evaluator’s bounded, pure TLA+ composition path.
This grants no expression or cached-result authority. The evaluator
inspects both operand closures without callbacks, requires complete
intermediate states and at most one complete tail successor, and calls
Self::check_action_composition on every declined case. Independent
replay uses this path with its own host and expression-cache domain.
Sourcefn 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.
§Errors
The host’s composition refusal or evaluation error.
Sourcefn 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.
Sourcefn 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).
Sourcefn 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.
§Errors
The named refusal.
Sourcefn 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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".