pub struct EachDirective {
pub path: String,
pub as_: String,
}Expand description
Iteration directive on an Element: instantiate one element per row of
a JSON array resolved from Spec::data.
At resolve time, the templated element is replaced by N clones with
auto-suffixed IDs ({element_id}-0, {element_id}-1, …). The loop
variable bound by as (default name "row") scopes $data paths
starting with /{as}/... to the current iteration row.
§Reserved names
The as field must NOT be one of ["data", "root", "_root", "_each", "this", "self"] — see SpecError::EachAsReservedName (validated by
Spec::validate in Plan 04).
§Wire format example
{
"type": "Card",
"$each": { "path": "/orders", "as": "order" },
"props": { "title": { "$data": "/order/order_number" } }
}§Resource bounds
At Plan 01, the directive is inert — no resolver runs yet. A hard cap on expansion size is a follow-up concern; Phase 163 does not impose a fixed limit. Spec authors are responsible for bounding the resolved array.
Fields§
§path: StringJSONPath-style slash-separated path to a JSON array in Spec::data.
as_: StringLoop-variable name bound during expansion. Paths starting with
/{as}/... in the templated element’s props resolve to the current row.
Trait Implementations§
Source§impl Clone for EachDirective
impl Clone for EachDirective
Source§fn clone(&self) -> EachDirective
fn clone(&self) -> EachDirective
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EachDirective
impl Debug for EachDirective
Source§impl<'de> Deserialize<'de> for EachDirective
impl<'de> Deserialize<'de> for EachDirective
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for EachDirective
impl PartialEq for EachDirective
Source§fn eq(&self, other: &EachDirective) -> bool
fn eq(&self, other: &EachDirective) -> bool
self and other values to be equal, and is used by ==.