Expand description
Assembly-time validation of Polydat node constant arguments.
Polydat’s contract (SRD 15 §“Input Validity Model”) keeps the hot
path branch-free by letting node ::new trust its constants —
no runtime checks. That only holds if the factory has already
proven each constant satisfies the node’s contract, rejecting
violations with a structured compile error before the node
is constructed.
This module provides the vocabulary for those checks:
ConstConstraintdescribes a single constraint on one constant argument. Apply it withConstConstraint::check.NodeValidatoris the per-module function the factory calls beforebuild. It gets the function name and the resolved constant args and returnsOk(())or a structured error string.
A module opts in by passing a validator as the third argument
to register_nodes!. Modules that don’t need validation omit
it and the factory skips the check.
Enums§
- Const
Constraint - A declarative constraint on one constant argument of a node call.
Functions§
- check_
opt - Convenience: apply a single constraint to an optional positional
argument. Absence is treated as “no value to check” (Ok) — the
requiredflag onParamSpecalready handles mandatory-ness.
Type Aliases§
- Node
Validator - Per-module validator the factory calls before
build_node.