From 8030bba615ba1aaad6c31fbbe7a5d1bc31dc098e Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 14 Apr 2026 09:23:12 +0000 Subject: perf(router)!: Replace per-request locks with lock-free frozen storage --- src/handler/hooks/post_route.rs | 6 +++--- src/handler/hooks/pre_route.rs | 6 +++--- src/handler/partial.rs | 6 +++--- 3 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 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 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 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) } } diff --git a/src/handler/partial.rs b/src/handler/partial.rs index a52fa59..a552096 100644 --- a/src/handler/partial.rs +++ b/src/handler/partial.rs @@ -2,11 +2,11 @@ use crate::context::RouteContext; #[allow(clippy::module_name_repetitions)] pub trait Partial: Send + Sync { - fn call(&mut self, context: &RouteContext) -> String; + fn call(&self, context: &RouteContext) -> String; } impl Partial for T -where T: FnMut(&RouteContext) -> String + Send + Sync +where T: Fn(&RouteContext) -> String + Send + Sync { - fn call(&mut self, context: &RouteContext) -> String { (*self)(context) } + fn call(&self, context: &RouteContext) -> String { (*self)(context) } } -- cgit v1.2.3