diff options
| author | Fuwn <[email protected]> | 2026-04-14 09:23:12 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-04-14 09:23:12 +0000 |
| commit | 8030bba615ba1aaad6c31fbbe7a5d1bc31dc098e (patch) | |
| tree | fc847483711476c407811ede02fea83641fcfedc /src/handler/hooks | |
| parent | perf(router)!: Pass RouteContext by reference to Partial headers and footers (diff) | |
| download | archived-windmark-8030bba615ba1aaad6c31fbbe7a5d1bc31dc098e.tar.xz archived-windmark-8030bba615ba1aaad6c31fbbe7a5d1bc31dc098e.zip | |
perf(router)!: Replace per-request locks with lock-free frozen storage
Diffstat (limited to 'src/handler/hooks')
| -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 1e1a6b6..0a6e6b7 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(&self, context: &HookContext, response: &mut Response); } impl<T> PostRouteHook for T -where T: FnMut(&HookContext, &mut Response) + Send + Sync +where T: Fn(&HookContext, &mut Response) + Send + Sync { - fn call(&mut self, context: &HookContext, response: &mut Response) { + fn call(&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 1d11d66..322969c 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(&self, context: &HookContext); } impl<T> PreRouteHook for T -where T: FnMut(&HookContext) + Send + Sync +where T: Fn(&HookContext) + Send + Sync { - fn call(&mut self, context: &HookContext) { (*self)(context) } + fn call(&self, context: &HookContext) { (*self)(context) } } |