summaryrefslogtreecommitdiffstats
path: root/vendor/handlebars/examples/partials.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:11:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:11:28 +0000
commit94a0819fe3a0d679c3042a77bfe6a2afc505daea (patch)
tree2b827afe6a05f3538db3f7803a88c4587fe85648 /vendor/handlebars/examples/partials.rs
parentAdding upstream version 1.64.0+dfsg1. (diff)
downloadrustc-94a0819fe3a0d679c3042a77bfe6a2afc505daea.tar.xz
rustc-94a0819fe3a0d679c3042a77bfe6a2afc505daea.zip
Adding upstream version 1.66.0+dfsg1.upstream/1.66.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--vendor/handlebars/examples/partials.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/vendor/handlebars/examples/partials.rs b/vendor/handlebars/examples/partials.rs
index 80b20c2f7..017dd04b7 100644
--- a/vendor/handlebars/examples/partials.rs
+++ b/vendor/handlebars/examples/partials.rs
@@ -1,9 +1,8 @@
extern crate env_logger;
extern crate handlebars;
-#[macro_use]
-extern crate maplit;
use handlebars::Handlebars;
+use serde_json::json;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
@@ -15,14 +14,14 @@ fn main() -> Result<(), Box<dyn Error>> {
handlebars.register_template_file("base0", "./examples/partials/base0.hbs")?;
handlebars.register_template_file("base1", "./examples/partials/base1.hbs")?;
- let data0 = btreemap! {
- "title".to_string() => "example 0".to_string(),
- "parent".to_string() => "base0".to_string()
- };
- let data1 = btreemap! {
- "title".to_string() => "example 1".to_string(),
- "parent".to_string() => "base1".to_string()
- };
+ let data0 = json!({
+ "title": "example 0",
+ "parent": "base0"
+ });
+ let data1 = json!({
+ "title": "example 1",
+ "parent": "base1"
+ });
println!("Page 0");
println!("{}", handlebars.render("template", &data0)?);