Expand description
WireSource — narrow read trait for op-template name resolution.
SRD-68 §“The narrow trait” specifies the wall between adapter
code and crate::scope_kernel::ScopeKernel internals: a dispenser
at cycle time accesses its bound Polydat context only through this
trait’s get (value lookup by name) and names (declared-name
iteration for diagnostics). No program(), no state(), no
scope_coordinates() — adapter code is sealed off from kernel
mechanics.
Two implementations ship here:
ScopeKernelitself, via the kernel’s existinglookupchain (input slots, outputs, inherited scope state). Single resolution surface — name resolves where SRD-67 places it, no fallback (SRD-68 invariant I-1).NullWireSource, a unit type that returnsNonefor every name. Used as the default value inExecCtx::newduring the SRD-68 migration so call sites that don’t yet have a kernel handle don’t break — adapters opt in viaExecCtx::with_wiresonce they own a kernel reference.
See docs/SRD/68_dispenser_owned_polydat_context.md.
Structs§
- Cycle
Wires WireSourceover a per-fiber kernel handle that supports the full read surface — inputs, scope-init constants, AND computed outputs (which need a memoizingpull(&mut state, …)to fire the eval cone). Wraps a&mut ScopeKernelin aMutexso the trait stays&self-callable (andSync) while still permitting pull’s&mutrequirement.- Kernel
Wires - Read-only
WireSourceover a kernel of any engine: the names a scope lookup answers (KernelLookup— a const’s value, an input, a folded value), as theScopeKernelimpl below does for the interpreter. Computed outputs that need a pull are not covered;CycleWiresis the surface that pulls. What an adapter’s canonical kernel offers a wrap-time reader. - Null
Wire Source - Empty
WireSource— everygetreturnsNone,namesis empty. Used as the default forExecCtx::newso callers that don’t yet have a kernel handle don’t need to construct a real implementation. Migration call sites switch toExecCtx::with_wireswhen they own a kernel reference (see SRD-68 Push 2 and beyond).
Enums§
- Host
Write Error - Why a
write_inputdid not land. - Write
Outcome - Result of a
WireSource::writecall.
Statics§
- NULL_
WIRES - Static
&'static dyn WireSourcefor use as the default inExecCtx::new. Avoids per-call allocation; the unit struct has no state to differ.
Traits§
- Program
Kernel - A kernel that carries the interpreter program its names resolve on: a scope kernel, or an interpreter kernel.
- Wire
Source - Cycle-time read surface a dispenser uses to resolve names from its bound Polydat context.
Functions§
- resolve_
op_ fields_ via_ wires - Resolve a list of op-template field entries through the generic
wires API. Each entry is
(field_name, json_value_from_template); the helper returns name+value pairs an adapter can hand to its renderer, with no synthesis-layer involvement. - substitute_
via_ wires - Render
templateby substituting each{name}placeholder withwires.get(name)’s display-string form. The single resolution-via-wires entry point adapters use at cycle time per SRD-68 Push 5 — replaces the synthesis-layersubstitute_bind_points*text-mutation pass. - write_
input - nmbrs’s one rule for writing a host value into a kernel input.