Quick start - unregistered template



examples/handlebars/handlebars-quick/src/main.rs
use handlebars::Handlebars;
use serde_json::json;
use std::error::Error;

fn main() {
    match render() {
        Ok(_) => println!(),
        Err(_) => println!("error"),
    }
}

fn render() -> Result<(), Box<dyn Error>> {
    let reg = Handlebars::new();
    println!(
        "{}",
        reg.render_template("Hello {{name}}", &json!({"name": "foo"}))?
    );

    Ok(())
}

examples/handlebars/handlebars-quick/out.html
Hello foo

examples/handlebars/handlebars-quick/Cargo.toml
[package]
name = "handlebars-quick"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
handlebars = "4.3.7"
serde_json = "1.0.97"