Skip to main content

PolydatKernel

Struct PolydatKernel 

Source
pub struct PolydatKernel {
    pub constants_folded: usize,
    /* private fields */
}
Expand description

A compiled Polydat Kernel: an Arc<PolydatProgram> plus one PolydatState.

§Invariants

  • Scope coordinates are always populated. After construction scope_coords reflects this kernel’s place in the comprehension chain: leaf-first list of super::ScopeCoord from the kernel’s own scope up through every enclosing comprehension. Root-scope kernels (no parent) start with their own coords (or empty). Self::materialize_wiring_from_outer re-computes the path so post-bind it includes the outer’s chain. Consumers (presentation layer, inspector, scope-aware diagnostics) call Self::scope_coordinates without needing to walk the scope tree themselves. See the scope model design document (docs/design/scope_model.md).

Fields§

§constants_folded: usize

Number of init-time constants folded during compilation.

Implementations§

Source§

impl PolydatKernel

Source

pub fn over(program: Arc<PolydatProgram>) -> Self

A fresh kernel over a shared, already compiled program: the host side of one program, many states.

Source

pub fn traverse(&mut self, index: usize) -> Result<TraversalStream, String>

Open the traversal at index among this program’s top-level for statements, evaluated against this kernel’s current values.

Comprehension sources that reference this kernel’s wires see the values currently set on it. Cascade externs are snapshotted from this kernel now and bound into every activation.

Source§

impl PolydatKernel

Source

pub fn mark_inherited_outputs<I>(&mut self, names: I)
where I: IntoIterator<Item = String>,

Mark a set of output names as inherited (cascade-only) on the program. Must be called immediately after construction, before the Arc<PolydatProgram> is shared. Panics if the Arc has other references.

Source

pub fn program(&self) -> &Arc<PolydatProgram> ⓘ

The shared immutable program.

Source

pub fn commit_write_throughs(&mut self) -> Result<(), String>

Per-cycle commit (subcontext_construction.md §5). Pulls each write- through’s synthetic source output and stores its value through the corresponding cell-bound input slot for the declared export name. Reads of that name in the parent or in sibling kernels share the same cell and observe the write on the next read.

TYPE-STABLE (scope_model.md §6.1): a cell keeps ONE type for life. Each pending value passes a typed boundary — matching types pass, a catalog adapter heals (e.g. the lossless U64→F64 widening), and an UNHEALABLE mismatch (narrowing, kind change) is an Err at THIS write site naming the cell, its declared type, the incoming type, and the producing binding — never a silent type flip that a compile-time-typed bridge trips over tiers later. Explicit narrowing is the author’s job via trunc_u64(...) / round_u64(...).

No-op when the kernel carries no write-throughs.

Source

pub fn set_cursor_schemas(&mut self, schemas: Vec<SourceSchema>)

Set source schemas on the program (called by the compiler).

Source

pub fn set_ast(&mut self, ast: Arc<PolydatFile>)

Attach the parsed AST as live program metadata. Called by every DSL compile entry point immediately after the assembler produces the kernel, while the program Arc is still uniquely owned. The subscope synthesizer queries this to integrate parent bindings’ matter into child scopes.

Source

pub fn set_traversals( &mut self, traversals: Vec<Traversal>, producers: Vec<Producer>, )

Attach compiled traversals and producers (for_traversal.md). Called by the DSL compiler while the program Arc is still uniquely owned.

Source

pub fn state(&mut self) -> &mut PolydatState

The per-fiber mutable evaluation state.

Source

pub fn state_ref(&self) -> &PolydatState

Read-only access to the kernel’s evaluation state. Used by callers (e.g. the scope-init pass) that need to inspect pulled values without consuming the kernel.

Source

pub fn set_inputs(&mut self, coords: &[u64])

Convenience: set coordinate inputs on the owned state.

Source

pub fn set_input(&mut self, name: &str, value: Value) -> Result<(), WriteError>

Set an extern by name on the owned state. The compiled kernels offer the same call, so a host drives every engine alike.

Source

pub fn set_input_at( &mut self, idx: usize, value: Value, ) -> Result<(), WriteError>

Self::set_input by input index, as find_input numbers them. The one write rule of every engine: the value satisfies the declared type or is None, and a coordinate is not written here.

Source

pub fn set_cursor( &mut self, name: &str, partition: &Partition, ) -> Result<(), WriteError>

Narrow a cursor to one partition: its Ext slot and six scalar projections are set, as cursor_partition::narrow_cursor does. The compiled kernels offer the same call. The partitions a cursor’s over clause denotes are in program().cursor_schemas() when the compiler could resolve them, or from cursor_partition::cursor_over_partitions otherwise.

Source

pub fn get_input(&self, name: &str) -> Option<Value>

Read an input value by name. Cell-aware: cell-bound slots return the cell’s current value.

Source

pub fn pull_ref(&mut self, output_name: &str) -> &Value

Evaluate output_name’s cone and borrow the result, which is the one thing this reader has over Kernel::pull: no clone. The value lives in the kernel’s own buffer, so the borrow ties to &mut self and ends at the next write.

Named pull_ref and not pull deliberately. An inherent pull here would shadow the trait’s, which returns an owned Value, and the same expression would mean different things depending on whether the caller held a PolydatKernel or a Box<dyn Kernel> — silently, since both sides answer as_u64 and the rest.

Source

pub fn pull_ref_at(&mut self, output_idx: usize) -> &Value

Self::pull_ref by the output’s index rather than its name, skipping the name resolution. Pair with PolydatProgram::output_index resolved once at bind time so a per-cycle reader pays no name hash on the hot path.

Source

pub fn propagate_inputs_into(&self, child: &mut PolydatKernel)

Copy self’s currently-set input-slot values into child’s input slots by name.

Companion to the internal materialize_wiring_from_outer pass that runs as part of build_subscope. That pass walks the parent’s outputs; this method walks the parent’s inputs — so cascade-extern’d names that the parent inherited from its parent reach child too, rather than stopping at the parent and silently leaving child’s matching slot at its default.

Value::None inputs are skipped (no point overwriting a child’s possibly-set default with absence). Inputs whose name has no matching slot on child are skipped silently — they’re not the child’s concern.

This is the kernel-chain operation that lets cascade-extern propagate transitively across multi-level scope chains. Each scope builder calls it after build_subscope finishes.

Source

pub fn input_names(&self) -> Vec<String>

Return the names of the inputs.

Source

pub fn output_names(&self) -> Vec<&str>

Return the names of all available output variates.

Source

pub fn get_constant(&self, name: &str) -> Option<&Value>

Read the value of a named output that was folded to a constant.

Underlying primitive — prefer Self::lookup for scope-aware name resolution. This method only succeeds for constant-folded outputs whose buffer is populated; it returns None for auto-passthrough outputs (where the value lives in the input slot) and for cycle-dependent outputs that haven’t been pulled.

A const captured at initialization answers from its slot, which initialization writes, so its value is there before anything pulls its output.

Source

pub fn find_l2f_violations(&self) -> Vec<String>

Find every const output whose initialization left the buffer as Value::None. The L2.f sub-axiom in composition_substrate.md describes this case: an intermediate-layer const X := <expr> whose RHS yields None falls through silently to the outer scope’s X via the conditional-shadow semantics in none_semantics.md. This method is the substrate’s “did silent fall-through occur” query — strict-mode callers (per L2.f’s strict-mode hardening note) use it to escalate the silent fall-through to a hard error.

Returns the const-output names whose buffers are Value::None after the scope-init pull. Empty Vec means every const materialised to a defined value. Polydat itself does not implement the strict-mode policy — it provides this query and the caller decides whether to surface a diagnostic.

Call only after materialize_wiring_from_outer has run (i.e., after the kernel is fully constructed and scope-init pulls have completed). Calling before scope-init returns a misleading result.

Source

pub fn lookup(&self, name: &str) -> Option<Value>

Look up a name in this kernel’s scope.

The canonical scope-aware read (scope_model.md §5): own-scope folded outputs shadow inherited extern values, with auto-passthrough outputs falling through to the input slot transparently.

Resolution order:

  1. Folded output buffer (compile-time constants).
  2. Cell-aware input read (covers extern values bound via materialize_wiring_from_outer, auto-passthrough outputs from input ...: u64 / extern, and shared-cell-backed slots — the cell is queried on every read so reads pick up writes from sibling kernels intrinsically).

Returns None when the name doesn’t resolve in either tier or when the resolved value is Value::None (unset).

Returns Value (owned, not borrowed) because shared-cell reads acquire a Mutex and clone out — there’s no long-lived borrow into the cell. For non-shared slots the clone is cheap (Value’s Clone is Arc-based for vectors, primitive copy otherwise).

This is the single read API for scope-aware name lookup and is cell-aware by default — callers don’t need to know whether a name is shared or not.

Source

pub fn cell_scope_snapshot(&self) -> PolydatKernel

Public form of Self::snapshot_with_cells: a fresh kernel mirroring this one’s program and full shared-cell view (own input-slot cells + transit cells, Arc-shared — the snapshot reads/writes the SAME cells as self). For holding a scope’s cell cascade past the point where the kernel itself is consumed (e.g. an executor keeping a phase-activation scope view alive for later build_subscope binds, after OpBuilder has taken the activation kernel by value). Non-cell state is fresh — this is a SCOPE view, not a value snapshot.

Source

pub fn advance_broadcasts(&mut self)

Advance this kernel’s broadcast state: pull every output that has an attached broadcast cell, forcing the eval cone to recompute against current inputs and writing the fresh value through the cell. Descendant kernels with input slots cell-attached to these outputs then observe the current value on their next read_input without any per-fiber-write coordination.

Intended to run once per cycle on each per-fiber outer kernel whose outputs are visible to inner scopes. The alternative — validity-bit + auto-pull-on-stale-read — would put the trigger fully inside the Polydat engine (so inner reads transparently fetch fresh values), but requires the engine to track upstream dependencies across the cell boundary. This eager-broadcast form is simpler and lives entirely within the kernel’s own surface: callers ask the kernel to advance its broadcasts; the kernel does the pulls; cells receive the values.

Source

pub fn replace_transit_cells(&mut self, cells: Vec<SharedCellEntry>)

Carry cells forward for this kernel’s descendants, replacing what it carried. The binder writes what the parent had and this kernel holds no slot for; the compiled engines keep the same list in their extern table.

Source

pub fn shared_cells_in_scope(&self) -> Vec<SharedCellEntry>

Every shared cell visible at this kernel’s scope — own input slots’ attached cells unioned with the transit cells inherited from ancestors. The typed ScopeKernel::shared_cells_in_scope delegates here.

Used by materialize_wiring_from_outer to compute the parent’s full visible cell set and propagate it to the child. Public for the typed surface; semantics are the same as the typed accessor.

Source

pub fn for_iteration( canonical: &Arc<PolydatKernel>, parent: &Arc<PolydatKernel>, bindings: &[(String, Value)], ) -> Arc<PolydatKernel> ⓘ

Construct a per-iteration kernel: clone canonical’s program, bind it to parent’s scope, and pre-load every (var, value) binding into the corresponding input slot.

§Cache-and-rehydrate pattern

for_iteration is the public entry point for the cache-and-rehydrate pattern a host builds on: compile a scope’s program once, then hydrate many per-instance kernels from it — one per iteration tuple, per fiber, per scenario-tree visit. The program is immutable substance (the Arc<PolydatProgram>); each hydrated kernel carries its own state (the input slot values for this iteration).

The pattern’s three load-bearing properties:

  1. Compile cost amortizes. Polydat source → typed program is paid once per canonical scope, not per iteration or per fiber. The compiled Arc<PolydatProgram> is shared via clone (cheap — refcount bump).
  2. Each hydrated kernel is independent. Per-fiber state means no synchronization between fibers running the same iteration in parallel. Each for_iteration call produces a fresh kernel with its own input slots, output cells, and write-through bindings.
  3. Parent-chain wiring is uniform. Every hydrated kernel runs through the parent’s materialize_subscope (and downstream materialize_wiring_from_outer) so cell propagation, shared-cell attach, and the read invariant (wire_materialization.md) are byte-identical to any other parent → child path.
§When to use this
  • Per-iteration kernel construction in scope walkers and pre-map walkers. The runtime dispatcher uses it before descending into a comprehension iteration’s children; the pre-map walker uses it so nested for_each clauses with outer-iter-var interpolation (vec_{profile}) resolve at pre-map time.
§Why one entry point

Owning the recipe here ensures both consumers (runtime dispatcher + pre-map walker) produce identical kernels for identical inputs, rather than each site composing from_program → materialize_wiring_from_outer → set_input on its own and drifting.

§See also
  • Self::from_program (internal) — the build-fresh-state primitive for_iteration composes with parent-chain wiring.
  • Self::propagate_inputs_into — the kernel-chain operation that extends cascade-extern values into a subkernel (called once after for_iteration from each scope walker so multi-level cascades reach the grandchild).
Source

pub fn scope_coordinates(&self) -> &[ScopeCoord]

The leaf-first scope coordinate path — see the scope model design document (docs/design/scope_model.md) for the formal definition. Always reflects the current binding state: after Self::materialize_wiring_from_outer the path includes the outer kernel’s full chain; for root scopes the path is just this kernel’s own coords (or empty).

Source

pub fn extend_scope_coordinates(&mut self, outer: &[ScopeCoord])

Refresh this kernel’s own coordinates and append outer’s path, giving [own] ++ outer. What the binder does once the child’s inputs are in, so the own-coord snapshot sees them.

Source

pub fn scope_values(&self) -> Vec<(String, Value)>

Extract the scope values that were set via materialize_wiring_from_outer. Returns [(name, value)] for inputs that are not at their default. Used by OpBuilder to inject the same values into every fiber’s state, including per-op-template kernels whose input layout differs from this kernel’s. The name- keyed shape is the cross-kernel-safe contract: an index captured against this kernel’s layout is meaningless when applied to a kernel synthesised from a different source (different extern declaration order, lazy-cascade omissions, etc.). Naming the binding makes the cross-scope write unambiguous — a missing name on the target program is a no-op rather than a silently mis-routed write.

A const’s slot is left out: only initialization writes it, and each kernel the values are written into initializes its own consts from them.

Source

pub fn into_program(self) -> Arc<PolydatProgram> ⓘ

Extract the program for concurrent use.

Source§

impl PolydatKernel

Source

pub fn build_subscope( &self, matter: PolydatMatter<'_>, ) -> Result<Box<dyn Kernel>, ContractViolation>

PolydatMatter::build_under this kernel: the child runs on the interpreter, this kernel’s engine.

Trait Implementations§

Source§

impl Construction for PolydatKernel

Source§

type Error = ContractViolation

Construction error type.
Source§

fn root(matter: PolydatMatter<'_>) -> Result<Self, Self::Error>

Path 1: build a root context from Polydat matter. No parent. Subscope-only fields on the matter (result-binding rewrites, inherited-output cascade, finalize-time contract checks) are not applicable here and are ignored.
Source§

fn subscope( &self, matter: PolydatMatter<'_>, ) -> Result<Box<dyn Kernel>, Self::Error>

Path 2: build a subscope context against self from Polydat matter. The parent supervises: cell cascade, Rule 2 rewrites, scope-coordinate threading, init-binding contract checks all flow from self into the child, which runs on self’s engine (super::subcontext::PolydatMatter::build_under).
Source§

impl Dataflow for PolydatKernel

Source§

fn get_wire_idx(&self, idx: usize) -> Value

Read the current value of wire idx. Out-of-range behaviour returns the slot’s default Value::None (the read path is non-fallible; type information is structural and reads cannot fail typewise).
Source§

fn get_wire<W: WireKey>(&self, key: W) -> Option<Value>

Read the current value of a wire identified by key (index or name). Returns None when the wire is not found.
Source§

impl Debug for PolydatKernel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Kernel for PolydatKernel

Source§

fn eval(&mut self)

Every output is pulled, so what a side channel observes is what it observes on a compiled kernel’s run.

Source§

fn engine(&self) -> Engine

The engine this kernel runs on.
Source§

fn set_inputs(&mut self, coords: &[u64])

Set the coordinate inputs for the next evaluation.
Source§

fn set_input(&mut self, name: &str, value: Value) -> Result<(), WriteError>

Set an extern by name. One rule on every engine: the value must satisfy the declared port type (a carrier’s bit-stuffed forms included) or be None, which clears the extern; a value of another type is refused at the write, never healed. A coordinate is set with Self::set_inputs, not here. An unknown name is an error naming the known ones.
Source§

fn set_cursor( &mut self, name: &str, partition: &Partition, ) -> Result<(), WriteError>

Narrow a cursor to one partition: its Ext slot and its six scalar projections are set.
Source§

fn pull(&mut self, name: &str) -> Value

The named output for the inputs set so far, evaluating what it needs and no more: the output’s cone, on all four engines (pure native code, though one function, runs only the fusion units of the output’s cone; engines.md §1). A side channel in the cone fires when the output is pulled; a failing node fails when pulled, with the same attributed message on every engine: the node’s name, the outputs it feeds, the program’s context, and its inputs. The value is owned; a handle is never returned to the host, and a slot that holds None reads as None.
Source§

fn input_names(&self) -> Vec<String>

Every input by name, the coordinates first.
Source§

fn output_names(&self) -> Vec<String>

Every named output.
Source§

fn output_type(&self, name: &str) -> Option<PortType>

The declared port type of a named output.
Source§

fn externs(&self) -> Vec<(String, PortType)>

The externs by name and declared type.
Source§

fn cursor_schemas(&self) -> &[SourceSchema]

The cursors the program declares, with the partitions the compiler resolved where it could.
Source§

fn input_value(&self, name: &str) -> Option<Value>

The value of a named input as the kernel holds it now, an extern or a coordinate; None for a name that is not an input.
Source§

fn input_index(&self, name: &str) -> Option<usize>

The index of a named input among Self::input_names, the coordinates first: what Self::set_input_at takes.
Source§

fn set_input_at(&mut self, index: usize, value: Value) -> Result<(), WriteError>

Self::set_input by index, for a host that binds the same inputs every cycle: the name is resolved once, with Self::input_index, and no lookup runs per write.
Source§

fn output_index(&self, name: &str) -> Option<usize>

The index of a named output among Self::output_names: what Self::pull_at takes.
Source§

fn const_inits(&self) -> &[ConstInit]

The const bindings this kernel initializes, in the order Self::init evaluates them: a const that reads another comes after it.
Source§

fn init_input_at( &mut self, index: usize, value: Value, ) -> Result<(), WriteError>

Write an input as part of initialization. It is Self::set_input_at except that a const’s slot is accepted, which is how Self::init stores each const’s value.
Source§

fn pull_at(&mut self, index: usize) -> Value

Self::pull by index, for a host that reads the same outputs every cycle: the name is resolved once, with Self::output_index, and no lookup runs per pull.
Source§

fn traversals(&self) -> &[Traversal]

The traversals the program declares, in document order.
Source§

fn plan(&self) -> EnginePlan

What this kernel’s engine decided for the program: how much of it runs as native segments, as closure steps, and on the interpreter. The one planning detail a kernel exposes.
Source§

fn traverse(&mut self, index: usize) -> Result<TraversalStream, String>

Open the traversal at index against this kernel’s current values (for_traversal.md §3.6): the comprehension’s sources see the wires they reference as this kernel holds them now, and the cascaded wires are snapshotted into every activation. Every engine opens traversals (engines.md §3.6).
Source§

fn invalidate_all(&mut self)

Begin the next cycle with nothing current, so every step, a side channel included, runs again when pulled. The runtime model makes a cycle whose inputs did not move cost nothing; this is how a host runs such a cycle anyway, as the polydat binary does when every input is fixed.
Source§

fn shared_cells(&self) -> Vec<SharedCellEntry>

The cells this kernel’s shared bindings are bound to (scope model §6): one register per binding, which every kernel holding the cell reads and writes.
Source§

fn output_cell(&self, name: &str) -> Option<SharedCell>

The broadcast cell for a computed output, created on the first ask: a descendant that binds its matching input slot to this cell reads the value each of this kernel’s pulls publishes through it, rather than a copy taken once when the descendant was built (cross_fiber_invalidation.md §3.1). Read more
Source§

fn output_modifier(&self, name: &str) -> BindingModifier

The binding modifier a named output was declared with — const, shared, final, or none. A binder reads it to decide how a descendant takes the output: a const is effectively fixed for the scope’s life and is value-copied, where a computed output is bound to its broadcast cell (scope_model.md §4). Read more
Source§

fn cells_in_scope(&self) -> Vec<SharedCellEntry>

Every cell a descendant of this kernel could bind to: the ones its own shared slots hold, plus the ones it carries forward for a descendant without holding a slot for them itself. The second kind is why an ancestral shared reaches a grandchild whose parent’s program never names it. Read more
Source§

fn set_transit_cells(&mut self, cells: Vec<SharedCellEntry>)

Carry cells forward for this kernel’s descendants. The binder writes what the parent had and this kernel holds no slot for.
Source§

fn scope_coordinates(&self) -> &[ScopeCoord]

This kernel’s place in the comprehension nest its scope was built under, outermost last: a child’s path is its own followed by its parent’s. Empty for a root, which is every kernel a host compiles rather than binds, so the compiled engines answer empty until one is bound under a parent.
Source§

fn extend_scope_coordinates(&mut self, outer: &[ScopeCoord])

Append outer to this kernel’s own scope-coordinate path, which the binder does once the child’s inputs are in. A no-op on an engine that keeps no path.
Source§

fn input_port_type(&self, name: &str) -> Option<PortType>

The declared type of a named input slot, coordinates included. The binder reads it to adapt a value the parent supplies into the type the child’s slot declares.
Source§

fn bind_input_cell(&mut self, name: &str, cell: SharedCell) -> bool

Bind the named input slot to cell, whether or not the slot was built as a shared register, and answer whether it was bound. Read more
Source§

fn attach_shared_cell( &mut self, name: &str, cell: SharedCell, ) -> Result<(), String>

Bind the shared binding name to cell, so this kernel and every other holder of the cell read and write one register: a write on any of them is what the others read next, and a dependent output is recomputed. A name that is not a shared binding is an error naming the ones that are.
Source§

fn into_program(self: Box<Self>) -> Arc<dyn KernelProgram> ⓘ

The program this kernel runs, shareable across threads: each thread creates its own kernel from it with KernelProgram::create_kernel. Read more
Source§

fn ledger(&self) -> &Arc<CompileLedger> ⓘ

The compile ledger of the program tree this kernel belongs to: what compiling it and everything opened from it has built.
Source§

fn resources(&self) -> &ResourceScope

The resource scope of the program tree this kernel belongs to: the slot for the host’s ResourceAccessor that every node of the tree looks resources up through. A host that did not hand one to the compile (CompileOptions::resources) installs its accessor here, once; kernels created from or forked off this one, subscopes built under it, and its traversal bodies share the scope.
Source§

fn canonical_hash(&self) -> [u8; 32]

The canonical hash of this kernel’s program (scope_model.md §8): equal for one program built on any of the four engines, and for every kernel created from or forked off it, and a function of what the program computes rather than of its source text. What a host keys a checkpoint on.
Source§

fn coord_count(&self) -> usize

How many of the inputs are coordinates: they come first in input_names, and set_inputs writes them.
Source§

fn input_value_at(&self, index: usize) -> Option<Value>

The value input index holds now: a coordinate’s pending or current value, an extern’s current value. None past the end.
Source§

fn input_default_at(&self, index: usize) -> Option<Value>

The value input index starts with: an extern’s declared default, U64(0) for a coordinate. None past the end.
Source§

fn input_is_cell_bound(&self, index: usize) -> bool

Whether input index is bound to a shared cell, so that its value is the cell’s and a reset leaves it alone.
Source§

fn reset_inputs(&mut self)

Every input that is not a coordinate and not bound to a cell back at its default, and whatever depends on a changed one not current. What a host does at a boundary where values written for the last stretch must not leak into the next.
Source§

fn fork(&self) -> Box<dyn Kernel>

A new kernel over the same program with this kernel’s state: its inputs, its current outputs, and its cells, which stay shared (a cell is the scope’s register, not a value it holds), transit cells included. Callable concurrently on a kernel shared across threads (native_scope_trees.md §4).
Source§

fn publish_broadcasts(&mut self)

Pull every output a descendant bound to by cell, so the descendant reads the current value. Nothing happens on a kernel nothing is bound under. A failing output is left for the pull that needs it to report.
Source§

fn commit_write_throughs(&mut self) -> Result<(), String>

Commit the Rule 2 write-throughs: pull each synthetic __write_<name> output and write it through the cell of the shared binding it exports to. No-op for a kernel without them.
Source§

fn program_id(&self) -> ProgramId

The identity of this kernel’s program: equal for kernels created from one program and for forks, different for any two programs, the same program compiled twice included. What a host seals a plan of pre-resolved indices against.
Source§

fn input_type_origin(&self, name: &str) -> Option<TypeOrigin>

How input name’s type was established: written by the author, or inferred by the compiler and so open to CompileOptions::input_variance (input_variance.md §3). A host that compiles many scopes at Info reports each open input once from here rather than from every compile’s log.
Source§

fn as_interpreter(&self) -> Option<&PolydatKernel>

The interpreter’s kernel, when this is one: what a caller that needs the interpreter’s own extras (Metadata, Dataflow, its program and state) reaches them through. None on a compiled engine.
Source§

fn as_interpreter_mut(&mut self) -> Option<&mut PolydatKernel>

Source§

fn init(&mut self) -> Result<(), KernelError>

Initialize the kernel: evaluate every const binding once, in dependency order, and store its value for the rest of the kernel’s life. Read more
Source§

fn traverse_all(&mut self) -> Result<Vec<TraversalStream>, String>

Open every traversal, in document order.
Source§

fn instance_hash(&self, ancestors: &[&dyn Kernel]) -> [u8; 32]

The instance hash of this kernel’s program under ancestors, innermost first (scope_model.md §8.2): what PolydatProgram::instance_hash gives for the same programs, whichever engines the kernels are on.
Source§

fn is_equivalent_to(&self, other: &dyn Kernel) -> bool

Whether other runs the same program (scope_model.md §8.3): their canonical hashes are equal, whichever engines the two are on.
Source§

fn is_subset_of(&self, parent: &dyn Kernel) -> bool

Whether this kernel’s program adds nothing parent’s does not already supply (scope_model.md §8.3): it is equivalent to parent, or it outputs nothing but its own inputs and every input it declares parent declares too. The answer PolydatProgram::is_subset_of gives for the same programs, on any engines.
Source§

impl Lookup for PolydatKernel

Source§

fn lookup(&self, name: &str) -> Option<Value>

The value name denotes here, if any.
Source§

fn ledger(&self) -> &Arc<CompileLedger> ⓘ

The compile ledger of the program tree this scope belongs to: what a source or predicate that has to compile is charged to.
Source§

impl Metadata for PolydatKernel

Source§

fn find_input(&self, name: &str) -> Option<usize>

Resolve an input name to its wire index, if present.
Source§

fn input_names(&self) -> Vec<String>

All declared input wire names, in declaration order.
Source§

fn output_names(&self) -> Vec<String>

All declared output wire names, in declaration order.
Source§

fn coord_count(&self) -> usize

Number of coordinate inputs (the leading prefix of the input slot vector — written via the cycle dispatcher).
Source§

fn input_port_type(&self, name: &str) -> Option<PortType>

Declared port type of an input wire, if known.
Source§

fn input_port_type_by_idx(&self, idx: usize) -> Option<PortType>

Declared port type of an input wire by index. The indexed counterpart of input_port_type, which looks up the slot’s type without first reverse-resolving an index to a name.
Source§

fn output_port_type(&self, name: &str) -> Option<PortType>

Declared port type of an output wire, if present. Symmetric counterpart to input_port_type. Used by the binder verification path (crate::binder::verify_against_kernel) to look up wire types for type-checking adapter binding shapes.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more