From 49ba82e6f549abc8cccf4324645a8d52e29f07ef Mon Sep 17 00:00:00 2001 From: optimizasean Date: Tue, 13 Dec 2022 17:08:57 -1000 Subject: [PATCH] Style: handlebars template clone in map - Adding clone in map for newer users (to make reusable) - Added note in comment on reusable enclosure to clone --- examples/handlebars_template.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/handlebars_template.rs b/examples/handlebars_template.rs index 78e040539..21253822e 100644 --- a/examples/handlebars_template.rs +++ b/examples/handlebars_template.rs @@ -42,7 +42,7 @@ async fn main() { // easily with others... let hb = Arc::new(hb); - // Create a reusable closure to render template + // Create a reusable closure to render template - clone it for each map use let handlebars = move |with_template| render(with_template, hb.clone()); //GET / @@ -52,7 +52,7 @@ async fn main() { name: "template.html", value: json!({"user" : "Warp"}), }) - .map(handlebars); + .map(handlebars.clone()); warp::serve(route).run(([127, 0, 0, 1], 3030)).await; }