[][src]Crate rdxl

HTML Templating Macros

This library contains JSX style inline HTML macros for Rust. The only dependencies are the ubiquitous proc-macro2, syn, and quote.

The library is semantic versioned, so expect small fixes and many additions until a 1.0 release is reached.

Inline Rust expressions

let x = 5;
let y = "asdf";
xhtml!({{ x }}, {{ y }})

Conditional expressions

let x = 5;
let y = "asdf";
xhtml!({{ if x>3 {{
  Case One
}} else if x>2 {{
  Case Two
}} else {{
  Case Three
}} }})

Loop expressions

xhtml!(<ul>{{ for i in 0..10 {{
  <li>{{ i }}</li>
}} }}</ul>)

Miscellaneous expressions

xhtml!(
  {{ let x = 5; }}
  {{ x }}
)

Html attributes

xhtml!(<div style={{ "\"color:red;\"" }}>
  inside div
</div>);

Macros

xhtml

The xhtml! macro is the primary mechanism for templating in rdxl

xrender

The xrender! macro defines a Display implementation for a type

xtype

The xtype! macro defines an xml element and subelements