aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-04-14 09:15:50 +0000
committerFuwn <[email protected]>2026-04-14 09:15:50 +0000
commit43092b1cdfd6e1321fb5cf4ca7d50fa5c25d04f1 (patch)
treec56dfcab5b666b602b32aed0f5f651e84ee64ea6 /examples
parentperf(context)!: Replace HashMap parameters with Parameters newtype backed by Vec (diff)
downloadarchived-windmark-43092b1cdfd6e1321fb5cf4ca7d50fa5c25d04f1.tar.xz
archived-windmark-43092b1cdfd6e1321fb5cf4ca7d50fa5c25d04f1.zip
perf(router)!: Pass RouteContext by reference to Partial headers and footers
Diffstat (limited to 'examples')
-rw-r--r--examples/partial.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/partial.rs b/examples/partial.rs
index 3bf60b0..c2bd689 100644
--- a/examples/partial.rs
+++ b/examples/partial.rs
@@ -5,11 +5,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
windmark::router::Router::new()
.set_private_key_file("windmark_private.pem")
.set_certificate_file("windmark_public.pem")
- .add_header(|_| "This is fancy art.\n".to_string())
- .add_footer(|context: windmark::context::RouteContext| {
+ .add_header(|_: &windmark::context::RouteContext| {
+ "This is fancy art.\n".to_string()
+ })
+ .add_footer(|context: &windmark::context::RouteContext| {
format!("\nYou came from '{}'.", context.url.path())
})
- .add_footer(|_| "\nCopyright (C) 2022".to_string())
+ .add_footer(|_: &windmark::context::RouteContext| {
+ "\nCopyright (C) 2022".to_string()
+ })
.mount("/", windmark::success!("Hello!"))
.run()
.await