[][src]Crate rdxl

HTML Templating Macros

Rdxl provides 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

  {{ let x = 5; }}
  {{ x }}

Html attributes

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



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


The xrender! macro defines a Display implementation for a type


The xtype! macro defines an xml element and subelements