pub fn parse_template(templ_str: &str) -> Result<Template<'_>, Error>
Expand description

Parses the template from string and makes a [Template<'a>]. Which you can render later./// Main Template that get’s passed around, consists of [Vec] of [TemplatePart<'a>]

    let templ = parse_template("hello {nickname?name?}. You're $(printf \"%.1f\" {weight})kg").unwrap();
    let parts = concat!("[Lit(\"hello \"), ",
                        "Any([Var(\"nickname\"), Var(\"name\"), Lit(\"\")]), ",
                        "Lit(\". You're \"), ",
                        "Cmd([Lit(\"printf \\\"%.1f\\\" \"), Var(\"weight\")]), ",
                        "Lit(\"kg\")]");
    assert_eq!(parts, format!("{:?}", templ));
}