Crate rdml

Crate rdml 

Source
Expand description

A generic templating language for rust ui frameworks

This is meant to be used for creating procedural macros to generate ui code.

§Implementors

§Example

#[proc_macro]
pub fn rdml(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
    let nodes = parse_macro_input!(tokens as Nodes);

    let nodes = nodes.nodes.iter().map(generate_node);

    quote! {
        ::leptos::prelude::view! {
            #(#nodes)*
        }
    }
    .into()
}

Structs§

Attribute
An attribute: class="value"
AttributeNameDirective
An attribute name with a directive: on:click
Attributes
An list of attributes: (class="value", id="value")
Block
A block of nodes surrounded by braces: { div {} [...] }
Element
An element
ExprNode
An expression interpolation node: (1 + 1).
ForNode
A for node
IfNode
An if template literal
MatchNode
A match node (match {})
MatchNodeArm
A match node arm. (pattern => node)
Node
A node with attributes
Nodes

Enums§

AttributeName
An attribute name
ElseNode
Either an else if {} clause or an else {} clause.
NodeType
A Node without attributes