pub enum TemplateAst {
Element {
tag: String,
attributes: Vec<Attribute>,
children: Vec<TemplateAst>,
self_closing: bool,
},
Text(String),
Expression(String),
RawExpression(String),
If {
condition: String,
then_branch: Box<TemplateAst>,
else_branch: Option<Box<TemplateAst>>,
},
For {
variable: String,
iterable: String,
body: Box<TemplateAst>,
},
Match {
expression: String,
arms: Vec<MatchArm>,
},
Component {
name: String,
props: Vec<PropValue>,
children: Option<Box<TemplateAst>>,
},
Children,
Fragment(Vec<TemplateAst>),
Raw(String),
}Variants§
Element
HTML element:
Text(String)
Plain text content
Expression(String)
Rust expression: {expr}
RawExpression(String)
Raw-HTML Rust expression: {!expr}. Content is emitted via
Html::raw(...) instead of Html::text(...), so the rendered
result is injected verbatim without HTML-entity escaping. Use
sparingly — caller is responsible for ensuring the expression
produces safe HTML.
If
Conditional rendering: if condition { … } else { … }
For
Loop rendering: for item in items { … }
Match
Match expression: match expr { … }
Component
Component invocation: @Button(props) or @Card(title: "x") { <p/>body }.
children carries the optional { ... } body block passed to the
callee as its children: Html prop.
Children
{children} inside a template body — placeholder that is replaced at
codegen with props.children.clone(). The props struct for the owning
component auto-gains a pub children: Html field when this variant
appears anywhere in the body.
Fragment(Vec<TemplateAst>)
Multiple nodes
Raw(String)
Raw HTML (unescaped)
Trait Implementations§
Source§impl Clone for TemplateAst
impl Clone for TemplateAst
Source§fn clone(&self) -> TemplateAst
fn clone(&self) -> TemplateAst
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TemplateAst
impl Debug for TemplateAst
Source§impl PartialEq for TemplateAst
impl PartialEq for TemplateAst
impl StructuralPartialEq for TemplateAst
Auto Trait Implementations§
impl Freeze for TemplateAst
impl RefUnwindSafe for TemplateAst
impl Send for TemplateAst
impl Sync for TemplateAst
impl Unpin for TemplateAst
impl UnsafeUnpin for TemplateAst
impl UnwindSafe for TemplateAst
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more