pub struct NestedElement { /* private fields */ }Expand description
Nested-tree element form for the ergonomic SpecBuilder::element_nested
API.
NestedElement mirrors ElementBuilder but with children: Vec<NestedElement>
instead of children: Vec<String>. The runtime Spec shape is UNCHANGED:
element_nested flattens this nested tree to the canonical flat element map
with auto-generated {parent_id}-{idx} IDs at .build() time. Once Spec
is constructed, the nested form is gone (D-07: the nested DSL is sugar over
construction only).
§When to reach for this
Only when neither a static JSON spec, nor $each, nor $if can express
the element graph (e.g., truly heterogeneous runtime construction).
§Limitations
NestedElement does NOT expose $each / $if directive setters in
Phase 163. Rust callers expressing iteration write the loop directly
in Rust. If a use case emerges for Rust-side directive injection, add
.each(...) / .if_(...) methods in a follow-up phase.
Implementations§
Source§impl NestedElement
impl NestedElement
Sourcepub fn child(self, c: NestedElement) -> Self
pub fn child(self, c: NestedElement) -> Self
Append a child node. Children are flattened to IDs {parent}-{idx} by
structural position when the spec is built.
Sourcepub fn visible(self, v: Visibility) -> Self
pub fn visible(self, v: Visibility) -> Self
Attach a visibility rule.