diff options
| author | Fuwn <[email protected]> | 2023-04-03 03:06:26 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-04-03 03:06:26 +0000 |
| commit | 3c030a23833a650af890491ef6e969f93c94b466 (patch) | |
| tree | 3daa321ea0eafa5df57172d587b0d67d4a70f56a /src/router.rs | |
| parent | refactor(returnable): seperate contexts (diff) | |
| download | windmark-3c030a23833a650af890491ef6e969f93c94b466.tar.xz windmark-3c030a23833a650af890491ef6e969f93c94b466.zip | |
refactor(context): callback -> hook
Diffstat (limited to 'src/router.rs')
| -rw-r--r-- | src/router.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/router.rs b/src/router.rs index 0862513..4e9c0a2 100644 --- a/src/router.rs +++ b/src/router.rs @@ -38,7 +38,7 @@ use crate::{ }, module::Module, response::Response, - context::{CallbackContext, ErrorContext, RouteContext}, + context::{HookContext, ErrorContext, RouteContext}, }; macro_rules! or_error { @@ -316,7 +316,7 @@ impl Router { let route = &mut self.routes.at(&fixed_path); for module in &mut *self.modules.lock().unwrap() { - module.on_pre_route(CallbackContext::new( + module.on_pre_route(HookContext::new( stream.get_ref(), &url, route.as_ref().map_or(None, |route| Some(&route.params)), @@ -324,7 +324,7 @@ impl Router { )); } - (*self.pre_route_callback).lock().unwrap()(CallbackContext::new( + (*self.pre_route_callback).lock().unwrap()(HookContext::new( stream.get_ref(), &url, route.as_ref().map_or(None, |route| Some(&route.params)), @@ -381,7 +381,7 @@ impl Router { }; for module in &mut *self.modules.lock().unwrap() { - module.on_post_route(CallbackContext::new( + module.on_post_route(HookContext::new( stream.get_ref(), &url, route.as_ref().map_or(None, |route| Some(&route.params)), @@ -390,7 +390,7 @@ impl Router { } (*self.post_route_callback).lock().unwrap()( - CallbackContext::new( + HookContext::new( stream.get_ref(), &url, route.as_ref().map_or(None, |route| Some(&route.params)), @@ -653,7 +653,7 @@ impl Router { /// /// ```rust /// use log::info; - /// use windmark::{context::CallbackContext, Response, Router}; + /// use windmark::{context::HookContext, Response, Router}; /// /// #[derive(Default)] /// struct Clicker { @@ -664,7 +664,7 @@ impl Router { /// info!("clicker has been attached!"); /// } /// - /// fn on_pre_route(&mut self, context: CallbackContext<'_>) { + /// fn on_pre_route(&mut self, context: HookContext<'_>) { /// self.clicks += 1; /// /// info!( @@ -674,7 +674,7 @@ impl Router { /// ); /// } /// - /// fn on_post_route(&mut self, context: CallbackContext<'_>) { + /// fn on_post_route(&mut self, context: HookContext<'_>) { /// info!( /// "clicker has been called post-route on {} with {} clicks!", /// context.url.path(), |