Aresty
A compiling template library for Rust.
Links:
- Crate: https://crates.io/crates/aresty
- Documentation: https://docs.rs/aresty
Usage
Add this to your Cargo.toml:
[]
= "0.1"
Examples
Sample .rst template
{{#for i in ints}}
{{i}}
{{/for}}
{{#for o in opts}}
{{#match o}}
{{=None}}Nothing at all
{{=Some(s)}}It is a "{{s}}"
{{/match}}
{{/for}}
Ad-hoc macro usage
use Write;
use ;
Proc macro on view struct
use ;
Supported tags
| Tag | effect |
|---|---|
| {{expr}} | expr is evaluated, and printed escaped |
| {{{expr}}} | expr is evaluated, and printed as is (without escaping) |
| {{!expr}} | expr is evaluated, but not printed (i.e. let) |
| {{#block}} | block opened (i.e. if, else, else if, for, match, etc.) |
| {{/block}} | block closed |
| {{=expr}} | expr branch for the parent match block; does not need to be closed |