Expand description
Trait surface that the #[polydat_node] proc-macro
(polydat-derive) calls into for boxing / unboxing wire
values.
§Canonical trait surface (SRD-80b)
Wire—Sized + 'staticRust-type ↔Valuebridge. Owned types only; the macro recognises borrow shapes (&str,&[u8],&[T],&serde_json::Value) syntactically and emits directmatch-on-Valueextraction at the eval call site — no trait dispatch, nounsafelifetime transmute.
Combinator Wire impls cover Option<T> (None-aware
pass-through) and Ext<T> (downcast through
ReflectedValue).
A Const<T> position is not a Wire: the macro classifies it
syntactically into a ConstShape and emits the extraction from
the ConstArg inline, so there is no trait for it to dispatch
through. A ConstSource trait once carried that, and stayed here
after the macro stopped emitting calls to it.
§Why the trait surface lives here
polydat-derive is a proc-macro crate — it can’t define
traits that are visible at the call site, only emit token
streams referencing traits defined elsewhere. The macro
emits <T as polydat::derive_support::Wire>::extract(...)
paths; this module is what those paths resolve to.
Structs§
- Config
- Marker wrapper signalling that the wrapped wire is a
configuration input — expensive to change because the node
keeps internal state (LUTs, alias tables, parsed specs)
derived from it. The macro emits the matching slot with
Port::config()(SRD 15 §“WireCost::Config”) so the compiler warns on cycle-time binding. - Const
- SRD-80 PR B.5 — marker wrapper for const arguments in
#[polydat_node]function signatures. - Dynamic
Outputs - Marker wrapper for node return types whose output port
COUNT is determined at construction time from a
const-list arg’s length, not at codegen time.
SRD-80b shape extension covering nodes like
mixed_radixthat emit one output per radix whereradixcount is a workload-supplied list. - Ext
- Operator-side wrapper for adapter-typed wire arguments.
Ext<T>signals “this arg comes fromValue::Ext(Box<dyn ReflectedValue>); downcast it toT.” ImplementsDeref/DerefMutlikeConst<T>so the body can use.method()directly. - Group
Resolver - Splice
dataset_group_open(<source>)upstream when the wire source is aStr(SRD-53DefaultResolver::Group). - Resolved
- SRD-80b in-spirit replacement for the
default_resolverattribute. TheRparameter (aResolverKindimpl) carries the auto-resolver kind; theTparameter is the concreteHandle-inner type the body sees.
Traits§
- Polydat
Setup - SRD-80 PR B.6 — construction-time setup contract for nodes
that derive a pre-computed runtime state from their const
args (e.g.
combinationsparsing a charset pattern into segments + modulus,regex_matchcompiling a pattern,histributionparsing a distribution spec). - Resolver
Kind - Marker trait that names a kind of source-string auto-resolver
for
Resolved<R, T>wire args. The variants here mirrorcrate::dsl::registry::DefaultResolver; each impl picks one of them. - Wire
- Rust-type ↔
Valuebridge.
Functions§
- buffer_
for - An empty buffer with room for
nelements, for a node whose buffer size comes from a value — a wire, a constant, or arithmetic on either. - read_
poly - A polymorphic port’s slots as the owned
Valuethe wire type names: a scalar from its bits, aRef2kind copied out of the pair its producer published. - ref_
value - The value a
Ref2pair at the head ofslotsholds by reference: the one-element slice a JSON, extension, or handle producer published (jit_boundary.md, axiom S7: one dereference). - reserve_
for buffer_forfor a buffer that is reused across evaluations:outis cleared and then has room fornelements. A native producer writing into step-owned scratch takes this shape, so its refusal reads the same as the node’s.- string_
for buffer_forfor text: an emptyStringwith room fornbytes.- try_
buffer_ for buffer_forfor a caller that reports failure as a value rather than as a node’s panic: a spec parser or a compile step, whose size comes from program text. The error is the same sentence.- write_
poly - A polymorphic return written by the node’s resolved output type: a
scalar as its bits into
outputs[0], aRef2kind intoscratch[0]with its pair republished (axiom S3). The value must be the port type’s carrier: the graph colored the slot by the node’s resolved output type, and a value of another type would be read by every consumer as something it is not, where the interpreter would have carried it. ANonehas no slot form on a compiled engine (engines.md §3.3).