pub struct Engine {
pub resilient: bool,
pub profile_override: Option<String>,
pub budget: Budget,
pub env: HashMap<String, String>,
pub env_fallback: Option<EnvLookup>,
}Fields§
§resilient: bool§profile_override: Option<String>CLI --profile override: when set, selects this profile instead
of the document’s active_profile key (spec §3.5).
budget: BudgetRuntime resource limits (spec/budgets.md, C-037). Violations are always fatal, in both modes.
env: HashMap<String, String>The closed environment snapshot: the ONLY external input
evaluation may read (spec/reproducibility.md §1, C-050).
new() snapshots the process environment (CLI-compatible);
with_env injects a fixed map (tests, agents, replays).
env_fallback: Option<EnvLookup>Lazy host lookup consulted on snapshot miss, before defaults
(F-016). None preserves legacy behavior exactly.
Implementations§
Source§impl Engine
impl Engine
pub fn new() -> Self
Sourcepub fn hermetic() -> Self
pub fn hermetic() -> Self
Hermetic engine: identical to new() except the environment starts
empty instead of snapshotting the process ambient. Embeddings (FFI,
WASM) use this so host ambient can never leak across the boundary;
host values arrive only through explicit maps or lookup callbacks.
Required on platforms without a process environment
(wasm32-unknown-unknown aborts on ambient access): construct here,
never snapshot-then-discard.
Sourcepub fn with_env(self, env: HashMap<String, String>) -> Self
pub fn with_env(self, env: HashMap<String, String>) -> Self
Fixed environment snapshot instead of the process ambient.
Sourcepub fn with_env_fallback(self, lookup: EnvLookup) -> Self
pub fn with_env_fallback(self, lookup: EnvLookup) -> Self
Lazy host lookup consulted on snapshot miss (F-016).
pub fn evaluate( &self, module: &Module, ) -> Result<(Value, Vec<Diagnostic>), EvalError>
Sourcepub fn evaluate_incremental(
&self,
module: &Module,
memo: &mut IncrementalMemo,
) -> Result<(Value, Vec<Diagnostic>), EvalError>
pub fn evaluate_incremental( &self, module: &Module, memo: &mut IncrementalMemo, ) -> Result<(Value, Vec<Diagnostic>), EvalError>
Incremental evaluation over a reused memo store (C-055, spec/performance.md §2): nodes whose structural fingerprint (expression shape, literal data, env values read, and dependency fingerprints) matches a previous call serve the memoized value and diagnostics; only the affected sub-DAG re-evaluates. Configuration changes (resilient flag, profile override, budgets) clear the store first. Post-walk transforms (profiles, patches, validation) re-run every call — they compose the final tree and stay cheap relative to the walk they follow.