diff options
| author | Fuwn <[email protected]> | 2023-04-15 02:00:45 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-04-15 02:00:45 +0000 |
| commit | c360d1d773bbfa9c9cfec97a202cc2b29b141010 (patch) | |
| tree | 41d389243e4e6308f7edf50d64ae51bb71bd3f78 /src/handler/hooks/post_route.rs | |
| parent | chore(examples): add sync module example (diff) | |
| download | windmark-c360d1d773bbfa9c9cfec97a202cc2b29b141010.tar.xz windmark-c360d1d773bbfa9c9cfec97a202cc2b29b141010.zip | |
refactor(hooks): implement call for hooks
Diffstat (limited to 'src/handler/hooks/post_route.rs')
| -rw-r--r-- | src/handler/hooks/post_route.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/handler/hooks/post_route.rs b/src/handler/hooks/post_route.rs index f4a919d..63a20b9 100644 --- a/src/handler/hooks/post_route.rs +++ b/src/handler/hooks/post_route.rs @@ -19,10 +19,14 @@ use crate::{context::HookContext, Response}; #[allow(clippy::module_name_repetitions)] -pub trait PostRouteHook: - FnMut(HookContext, &mut Response) + Send + Sync -{ +pub trait PostRouteHook: Send + Sync { + fn call(&mut self, context: HookContext, response: &mut Response); } -impl<T> PostRouteHook for T where T: FnMut(HookContext, &mut Response) + Send + Sync -{} +impl<T> PostRouteHook for T +where T: FnMut(HookContext, &mut Response) + Send + Sync +{ + fn call(&mut self, context: HookContext, response: &mut Response) { + (*self)(context, response); + } +} |