[][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";
rdxl!({{ x }}, {{ y }})

Conditional expressions

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

Loop expressions

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

Miscellaneous expressions

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

Html attributes

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

Macros

rdxl