From 43092b1cdfd6e1321fb5cf4ca7d50fa5c25d04f1 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 14 Apr 2026 09:15:50 +0000 Subject: perf(router)!: Pass RouteContext by reference to Partial headers and footers --- examples/partial.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'examples') 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> { 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 -- cgit v1.2.3