pub enum BodyItem {
Property(TeksiProperty),
Child(TeksiElement),
Binding {
name: Ident,
element: TeksiElement,
},
Escape {
expr: Expr,
span: Span,
},
Let(Local),
Rust {
block: Block,
span: Span,
shape: RustShape,
},
If(TeksiIf),
Match(TeksiMatch),
For(TeksiFor),
Spread {
expr: Expr,
span: Span,
},
}Expand description
One item in an element’s body block.
Variants§
Property(TeksiProperty)
name: arg1, arg2, ... — builder method call with N args.
A bare lowercase ident with no body is modeled as args == [].
Child(TeksiElement)
A bare element at body position — attaches via .child(...).
Binding
name = Element — a binding that hoists let name = ctx.add(...)
to the enclosing statement-forming block, then attaches via
.add_child(name) on the parent.
Escape
#{ expr } at body position — the expr is expected to evaluate
to a WidgetId and attaches via .add_child(expr).
The semantics are simple: always WidgetId. The full
IntoTeksiChild routing (widget-or-id dispatch) is not yet implemented.
Let(Local)
let pat = expr; at body position. Introduces a
local whose value is used by subsequent body items. Triggers
statement-sequence lowering on the enclosing element.
Rust
rust { ... } imperative escape. Two forms:
expression-producing (block tail has no semicolon, lowered as
.child(block)) and side-effect (block tail ends in ;,
emitted inline as a side-effect statement).
If(TeksiIf)
if cond { Element } [else if cond { Element }]* [else { Element }]?
Lowers to .child_opt(...) (no-else) or
.child(TeksiBranch{N}::...) (with else branches).
Match(TeksiMatch)
match expr { pat => Element, ... }. Lowers to
.child(match ... { ... TeksiBranch{N}::... }) with arms
dispatched by variant index.
For(TeksiFor)
for pat in iter { Element }. Lowers to
.children(iter.map(|pat| Element)).
Spread
..expr — inlines an iterator of WidgetIds as
children. Forces statement-sequence lowering on the parent.