From 873cef6fbba01c99733c97378b5f001779604cf4 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 6 Apr 2023 08:34:24 +0000 Subject: fix(context): custom parameters format for easy lifetimes --- src/router.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/router.rs') diff --git a/src/router.rs b/src/router.rs index 030ffb8..0b550c4 100644 --- a/src/router.rs +++ b/src/router.rs @@ -162,7 +162,7 @@ impl Router { pub fn mount( &mut self, route: impl Into + AsRef, - mut handler: impl FnMut(RouteContext<'_>) -> R + Send + Sync + 'static, + mut handler: impl FnMut(RouteContext) -> R + Send + Sync + 'static, ) -> &mut Self where R: IntoFuture + Send + 'static, @@ -172,9 +172,9 @@ impl Router { .routes .insert( route.into(), - Arc::new(AsyncMutex::new(Box::new( - move |context: RouteContext<'_>| handler(context).into_future(), - ))), + Arc::new(AsyncMutex::new(Box::new(move |context: RouteContext| { + handler(context).into_future() + }))), ) .unwrap(); @@ -375,7 +375,7 @@ impl Router { let route_context = RouteContext::new( stream.get_ref().peer_addr(), url.clone(), - route.params.clone(), + &route.params, peer_certificate, ); -- cgit v1.2.3