utkarshkukreti / markup.rs

A blazing fast, type-safe template engine for Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add @match

utkarshkukreti opened this issue · comments

Test case:

@for x in &[(1, 2), (3, 3), (5, 4), (0, 1)] {
    @match x {
        (1, 2) => "1 -> 2\n",
        (x, y) if x == y => { "eq" "\n" },
        (x, y) if x == y + 1 => {
            div { {x} {y} } "\n"
        }
        _ => "!\n"
    }
}

Output:

1 -> 2
eq
<div>54</div>
!