diff options
| author | Fuwn <[email protected]> | 2026-04-14 09:05:03 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-04-14 09:05:03 +0000 |
| commit | 92180ab10c5cd1394b3c288e4d730aa37c527629 (patch) | |
| tree | 17c1495e9724662206ef8c42091f972a0f2bc243 /src/handler | |
| parent | perf(router)!: Remove AsyncMutex from route and error handlers (diff) | |
| download | archived-windmark-92180ab10c5cd1394b3c288e4d730aa37c527629.tar.xz archived-windmark-92180ab10c5cd1394b3c288e4d730aa37c527629.zip | |
perf(router)!: Pass HookContext by reference to modules and hooks
Diffstat (limited to 'src/handler')
| -rw-r--r-- | src/handler/hooks/post_route.rs | 6 | ||||
| -rw-r--r-- | src/handler/hooks/pre_route.rs | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/handler/hooks/post_route.rs b/src/handler/hooks/post_route.rs index 6bc24b2..1e1a6b6 100644 --- a/src/handler/hooks/post_route.rs +++ b/src/handler/hooks/post_route.rs @@ -2,13 +2,13 @@ use crate::{context::HookContext, response::Response}; #[allow(clippy::module_name_repetitions)] pub trait PostRouteHook: Send + Sync { - fn call(&mut self, context: HookContext, response: &mut Response); + fn call(&mut self, context: &HookContext, response: &mut Response); } impl<T> PostRouteHook for T -where T: FnMut(HookContext, &mut Response) + Send + Sync +where T: FnMut(&HookContext, &mut Response) + Send + Sync { - fn call(&mut self, context: HookContext, response: &mut Response) { + fn call(&mut self, context: &HookContext, response: &mut Response) { (*self)(context, response); } } diff --git a/src/handler/hooks/pre_route.rs b/src/handler/hooks/pre_route.rs index 9b1eb7f..1d11d66 100644 --- a/src/handler/hooks/pre_route.rs +++ b/src/handler/hooks/pre_route.rs @@ -2,11 +2,11 @@ use crate::context::HookContext; #[allow(clippy::module_name_repetitions)] pub trait PreRouteHook: Send + Sync { - fn call(&mut self, context: HookContext); + fn call(&mut self, context: &HookContext); } impl<T> PreRouteHook for T -where T: FnMut(HookContext) + Send + Sync +where T: FnMut(&HookContext) + Send + Sync { - fn call(&mut self, context: HookContext) { (*self)(context) } + fn call(&mut self, context: &HookContext) { (*self)(context) } } |