pub struct Engine {
pub env: Rc<Env>,
pub deferred_slots: RefCell<Vec<(Inst, String)>>,
pub failed_inputs: RefCell<HashSet<String>>,
pub reads: RefCell<HashMap<String, HashSet<String>>>,
pub computing: RefCell<Vec<String>>,
pub slots_by_key: RefCell<HashMap<String, (Inst, String)>>,
pub deferred_roots: RefCell<Vec<DeferredRoot>>,
/* private fields */
}Fields§
§env: Rc<Env>§deferred_slots: RefCell<Vec<(Inst, String)>>§failed_inputs: RefCell<HashSet<String>>inputs whose fallback failed to bind: later demands are tainted, not re-reported
reads: RefCell<HashMap<String, HashSet<String>>>§computing: RefCell<Vec<String>>§slots_by_key: RefCell<HashMap<String, (Inst, String)>>§deferred_roots: RefCell<Vec<DeferredRoot>>roots whose binding deferred through $referrers in phase 1: bound again after the deferred slots
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn bare(env: Rc<Env>) -> Rc<Engine>
pub fn bare(env: Rc<Env>) -> Rc<Engine>
an engine without registering itself as the environment’s evaluator
pub fn slot_key(inst: &Inst, name: &str) -> String
pub fn record(&self, read: String)
pub fn step<T>(&self, key: &str, f: impl FnOnce() -> T) -> T
pub fn phase(&self) -> u8
pub fn new(env: Rc<Env>) -> Rc<Engine>
Sourcepub fn install_hooks(self: &Rc<Self>, env: &Rc<Env>, with_menv: bool)
pub fn install_hooks(self: &Rc<Self>, env: &Rc<Env>, with_menv: bool)
§4.13 / unit factors: let the environment evaluate constants through this engine
pub fn ev(&self, e: &Rc<Expr>, sc: &Scope) -> R<Value>
pub fn member_of(&self, v: &Value, rt: &RT, sc: &Scope) -> bool
pub fn demand_input(&self, menv: &Rc<Env>, name: &str) -> R<Option<Value>>
pub fn bind_root(&self, name: &str, src: RootSrc<'_>, rt: &RT, sc: &Scope)
Sourcepub fn bind_deferred_roots(&self)
pub fn bind_deferred_roots(&self)
phase 2: the roots that deferred are bound again (after the deferred slots)
pub fn deref(&self, v: Value) -> R<Value>
pub fn resolve_segs(&self, segs: &[Seg]) -> R<Value>
pub fn resolve_canonical(&self, segs: &[Seg]) -> R<Value>
pub fn call(&self, f: &Value, args: Vec<Value>, sc: &Scope) -> R<Value>
pub fn bind( &self, raw: Value, rt: &RT, path: &[Seg], parent: Option<&Inst>, sc: &Scope, ) -> R<Value>
pub fn eval_place(&self, e: &Rc<Expr>, sc: &Scope) -> R<Option<SegPath>>
pub fn materialize(&self, v: Value, path: &[Seg]) -> R<Value>
pub fn force_state(&self, inst: &Inst, name: &str) -> SlotState
pub fn force_slot_safe(&self, inst: &Inst, name: &str)
pub fn force_slot(&self, inst: &Inst, name: &str) -> R<Value>
pub fn force_const_in( &self, env: &Rc<Env>, name: &str, root_name: &str, ) -> R<Value>
pub fn force_all(&self, v: &Value)
Sourcepub fn set_phase(&self, p: u8)
pub fn set_phase(&self, p: u8)
the evaluation phase: 1 materialization, 2 universe complete ($referrers answers)
Sourcepub fn force_roots(&self, env: &Env)
pub fn force_roots(&self, env: &Env)
force every root, run the $referrers phase, then the assertion pass force every root, the roots demanded on the way included (an input bound through its fallback while another root is forced becomes a root too, and is forced in the same pass — the reference walks the live root map)
pub fn drive(&self, env: &Env)
pub fn validate_all(&self, root_name: &str)
pub fn validate_inst(&self, inst: &Inst, root_name: &str)
Sourcepub fn reset_slot(&self, key: &str) -> bool
pub fn reset_slot(&self, key: &str) -> bool
reset a computed slot so that it is computed again (dependency tracking)
Sourcepub fn serialize(
&self,
v: &Value,
root_name: &str,
settable_only: bool,
) -> String
pub fn serialize( &self, v: &Value, root_name: &str, settable_only: bool, ) -> String
canonical JSON of a value (§10.4, D29): derived members included,
hidden never; settable_only is the tool option D29 provides — the
settable projection (required, optional, defaulted members) that a
document for the same type would carry