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§

§

impl !Send for BodyItem

§

impl !Sync for BodyItem

§

impl Forget for BodyItem

§

impl Freeze for BodyItem
where NonZero<u32>: Freeze, *const str is !null: Freeze, PhantomData<str>: Freeze, PhantomData<Rc<()>>: Freeze, *const u8 is !null: Freeze, PhantomData<PropArg>: Freeze, PhantomData<(PathSegment, PathSep)>: Freeze, *const PathSegment is !null: Freeze, PhantomData<PathSegment>: Freeze, PhantomData<Expr>: Freeze, PhantomData<BodyItem>: Freeze, PhantomData<Attribute>: Freeze, PhantomData<(Expr, Comma)>: Freeze, *const Expr is !null: Freeze, PhantomData<Stmt>: Freeze, *const Type is !null: Freeze, PhantomData<Type>: Freeze, PhantomData<(GenericParam, Comma)>: Freeze, *const GenericParam is !null: Freeze, PhantomData<GenericParam>: Freeze, PhantomData<(Pat, Comma)>: Freeze, *const Pat is !null: Freeze, PhantomData<Pat>: Freeze, *const LitRepr is !null: Freeze, PhantomData<LitRepr>: Freeze, *const LitIntRepr is !null: Freeze, PhantomData<LitIntRepr>: Freeze, *const LitFloatRepr is !null: Freeze, PhantomData<LitFloatRepr>: Freeze, PhantomData<u8>: Freeze, PhantomData<TokenTree>: Freeze, *const RcInner<Vec<TokenTree>> is !null: Freeze, PhantomData<RcInner<Vec<TokenTree>>>: Freeze, PhantomData<Arm>: Freeze, PhantomData<(GenericArgument, Comma)>: Freeze, *const GenericArgument is !null: Freeze, PhantomData<GenericArgument>: Freeze, PhantomData<(FieldValue, Comma)>: Freeze, *const FieldValue is !null: Freeze, PhantomData<FieldValue>: Freeze, PhantomData<(Pat, Or)>: Freeze, PhantomData<(FieldPat, Comma)>: Freeze, *const FieldPat is !null: Freeze, PhantomData<FieldPat>: Freeze, *const TeksiElse is !null: Freeze, PhantomData<TeksiElse>: Freeze, PhantomData<TeksiMatchArm>: Freeze, PhantomData<Local>: Freeze,

§

impl Move for BodyItem

§

impl RefUnwindSafe for BodyItem
where NonZero<u32>: RefUnwindSafe, ProcMacroAutoTraits: RefUnwindSafe, RcVec<TokenTree>: RefUnwindSafe,

§

impl Unpin for BodyItem

§

impl UnsafeUnpin for BodyItem
where NonZeroU32Inner: UnsafeUnpin, *const str is !null: UnsafeUnpin, PhantomData<str>: UnsafeUnpin, PhantomData<Rc<()>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<PropArg>: UnsafeUnpin, PhantomData<(PathSegment, PathSep)>: UnsafeUnpin, *const PathSegment is !null: UnsafeUnpin, PhantomData<PathSegment>: UnsafeUnpin, PhantomData<Expr>: UnsafeUnpin, PhantomData<BodyItem>: UnsafeUnpin, PhantomData<Attribute>: UnsafeUnpin, PhantomData<(Expr, Comma)>: UnsafeUnpin, *const Expr is !null: UnsafeUnpin, PhantomData<Stmt>: UnsafeUnpin, *const Type is !null: UnsafeUnpin, PhantomData<Type>: UnsafeUnpin, PhantomData<(GenericParam, Comma)>: UnsafeUnpin, *const GenericParam is !null: UnsafeUnpin, PhantomData<GenericParam>: UnsafeUnpin, PhantomData<(Pat, Comma)>: UnsafeUnpin, *const Pat is !null: UnsafeUnpin, PhantomData<Pat>: UnsafeUnpin, *const LitRepr is !null: UnsafeUnpin, PhantomData<LitRepr>: UnsafeUnpin, *const LitIntRepr is !null: UnsafeUnpin, PhantomData<LitIntRepr>: UnsafeUnpin, *const LitFloatRepr is !null: UnsafeUnpin, PhantomData<LitFloatRepr>: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, PhantomData<TokenTree>: UnsafeUnpin, *const RcInner<Vec<TokenTree>> is !null: UnsafeUnpin, PhantomData<RcInner<Vec<TokenTree>>>: UnsafeUnpin, PhantomData<Arm>: UnsafeUnpin, PhantomData<(GenericArgument, Comma)>: UnsafeUnpin, *const GenericArgument is !null: UnsafeUnpin, PhantomData<GenericArgument>: UnsafeUnpin, PhantomData<(FieldValue, Comma)>: UnsafeUnpin, *const FieldValue is !null: UnsafeUnpin, PhantomData<FieldValue>: UnsafeUnpin, PhantomData<(Pat, Or)>: UnsafeUnpin, PhantomData<(FieldPat, Comma)>: UnsafeUnpin, *const FieldPat is !null: UnsafeUnpin, PhantomData<FieldPat>: UnsafeUnpin, *const TeksiElse is !null: UnsafeUnpin, PhantomData<TeksiElse>: UnsafeUnpin, PhantomData<TeksiMatchArm>: UnsafeUnpin, PhantomData<Local>: UnsafeUnpin,

§

impl UnwindSafe for BodyItem
where NonZero<u32>: UnwindSafe, BoxRaw<str>: UnwindSafe, ProcMacroAutoTraits: UnwindSafe, RawVecInner: UnwindSafe, BoxRaw<Type>: UnwindSafe, BoxRaw<Lifetime>: UnwindSafe, BoxRaw<CapturedParam>: UnwindSafe, Rc<Vec<TokenTree>>: UnwindSafe, BoxRaw<TypeParamBound>: UnwindSafe, BoxRaw<GenericParam>: UnwindSafe, BoxRaw<LitRepr>: UnwindSafe, BoxRaw<NamedArg>: UnwindSafe, BoxRaw<GenericArgument>: UnwindSafe, BoxRaw<PathSegment>: UnwindSafe, BoxRaw<Expr>: UnwindSafe, BoxRaw<Pat>: UnwindSafe, BoxRaw<LitIntRepr>: UnwindSafe, BoxRaw<LitFloatRepr>: UnwindSafe, BoxRaw<FieldPat>: UnwindSafe, BoxRaw<Path>: UnwindSafe, BoxRaw<WherePredicate>: UnwindSafe, BoxRaw<Field>: UnwindSafe, BoxRaw<Variant>: UnwindSafe, BoxRaw<FnArg>: UnwindSafe, BoxRaw<Block>: UnwindSafe, BoxRaw<UseTree>: UnwindSafe, BoxRaw<FieldValue>: UnwindSafe, BoxRaw<TeksiElse>: UnwindSafe,

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.