Skip to main content

BodyItem

Enum BodyItem 

Source
pub enum BodyItem {
    Property(TeksiProperty),
    Child(TeksiElement),
    ExprChild {
        expr: Expr,
        span: Span,
    },
    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(...).

§

ExprChild

A bare Rust expression at body position that evaluates to a widget — the section("Header") / row(x).bold() helper-call shape. Attaches via .child(expr). Distinct from Child, which is a teksu element the macro constructs itself.

Fields

§expr: Expr
§span: Span
§

Binding

name = Element — a binding that hoists let name = ctx.add(...) to the enclosing statement-forming block, then attaches via .child(name) on the parent.

Fields

§name: Ident
§

Escape

#{ expr } at body position — attaches via .child(expr). child takes impl IntoTeksiChild, so the expr may be a WidgetId or a widget value.

Fields

§expr: Expr
§span: Span
§

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).

Fields

§block: Block
§span: Span
§

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.

Fields

§expr: Expr
§span: Span

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.