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/handler/hooks/post_route.rs | 4 ++-- src/handler/hooks/pre_route.rs | 4 ++-- src/handler/partial.rs | 4 ++-- src/handler/response/route.rs | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/handler') diff --git a/src/handler/hooks/post_route.rs b/src/handler/hooks/post_route.rs index eea0128..f4a919d 100644 --- a/src/handler/hooks/post_route.rs +++ b/src/handler/hooks/post_route.rs @@ -20,9 +20,9 @@ use crate::{context::HookContext, Response}; #[allow(clippy::module_name_repetitions)] pub trait PostRouteHook: - FnMut(HookContext<'_>, &mut Response) + Send + Sync + FnMut(HookContext, &mut Response) + Send + Sync { } -impl PostRouteHook for T where T: FnMut(HookContext<'_>, &mut Response) + Send + Sync +impl PostRouteHook for T where T: FnMut(HookContext, &mut Response) + Send + Sync {} diff --git a/src/handler/hooks/pre_route.rs b/src/handler/hooks/pre_route.rs index 13f4482..af5ed9d 100644 --- a/src/handler/hooks/pre_route.rs +++ b/src/handler/hooks/pre_route.rs @@ -19,6 +19,6 @@ use crate::context::HookContext; #[allow(clippy::module_name_repetitions)] -pub trait PreRouteHook: FnMut(HookContext<'_>) + Send + Sync {} +pub trait PreRouteHook: FnMut(HookContext) + Send + Sync {} -impl PreRouteHook for T where T: FnMut(HookContext<'_>) + Send + Sync {} +impl PreRouteHook for T where T: FnMut(HookContext) + Send + Sync {} diff --git a/src/handler/partial.rs b/src/handler/partial.rs index 3d5bfb2..1d55b93 100644 --- a/src/handler/partial.rs +++ b/src/handler/partial.rs @@ -18,6 +18,6 @@ use crate::context::RouteContext; -pub trait Partial: FnMut(RouteContext<'_>) -> String + Send + Sync {} +pub trait Partial: FnMut(RouteContext) -> String + Send + Sync {} -impl Partial for T where T: FnMut(RouteContext<'_>) -> String + Send + Sync {} +impl Partial for T where T: FnMut(RouteContext) -> String + Send + Sync {} diff --git a/src/handler/response/route.rs b/src/handler/response/route.rs index a65b889..c7df774 100644 --- a/src/handler/response/route.rs +++ b/src/handler/response/route.rs @@ -23,16 +23,16 @@ use crate::{context::RouteContext, Response}; #[allow(clippy::module_name_repetitions)] #[async_trait] pub trait RouteResponse: Send + Sync { - async fn call(&mut self, context: RouteContext<'_>) -> Response; + async fn call(&mut self, context: RouteContext) -> Response; } #[async_trait] impl RouteResponse for T where - T: FnMut(RouteContext<'_>) -> F + Send + Sync, + T: FnMut(RouteContext) -> F + Send + Sync, F: std::future::Future + Send + 'static, { - async fn call(&mut self, context: RouteContext<'_>) -> Response { + async fn call(&mut self, context: RouteContext) -> Response { (*self)(context).await } } -- cgit v1.2.3