pub enum ResultSpec {
String(String),
List(Vec<ResultSpec>),
Map(BTreeMap<String, String>),
}Expand description
SRD-66 result-bindings declaration. Vari-structured to match the three YAML shapes the user can write:
- String: a multi-line Polydat source block. Each
<name> := <expr>assignment declares one result wire. - List: a sequence of nested
ResultSpecs; each element processes in order and contributes its declarations. - Map: named-key short-forms (
count,ok, path-expr, or any other string treated as a GK expression). Map shape additionally produces a composite-map wire (deferred — see Push 2 follow-ups).
SRD-40b §5.1’s mapping form is preserved as the map
shape with two refinements: any non-built-in non-path
string is a Polydat expression (no (-detector magic), and
the composite-map output is added.
Variants§
String(String)
Polydat source block — one or more <name> := <expr>
assignments separated by newlines. The pre-bound
wires (body, count, ok, captures) are
available; references resolve via the standard
closure-binding rule (polydat module matter detects
linkages).
List(Vec<ResultSpec>)
Sequence of fragments. Each element is itself a
ResultSpec (string or map; nested lists are parsed
but unconventional). Fragments concatenate into one
result-bindings scope; key collisions across map-
shape fragments are a hard error.
Map(BTreeMap<String, String>)
Named-key short-forms. Each value is one of:
"count", "ok", a path expression (no parens), or
any other string treated as a Polydat expression. Map
shape also produces a composite-map wire keyed by
the YAML keys.
Implementations§
Source§impl ResultSpec
impl ResultSpec
Sourcepub fn walk_fragments<F: FnMut(ResultFragment<'_>)>(&self, on: F)
pub fn walk_fragments<F: FnMut(ResultFragment<'_>)>(&self, on: F)
Walk the spec tree (handling list-shape recursion) and yield every (wire-name, source-expr) pair the spec ultimately declares.
For map-shape entries, the source is whatever the
user wrote (count / ok / path-expr / Polydat expr).
For string-shape entries, the source is the entire
Polydat block — the caller compiles it as a unit and
extracts wire names from the LHS of each :=
assignment.