(&self, hook: Hook)
| 178 | } |
| 179 | |
| 180 | pub async fn register(&self, hook: Hook) { |
| 181 | let mut hooks = self.hooks.write().await; |
| 182 | let entry = hooks.entry(hook.event.clone()).or_insert_with(Vec::new); |
| 183 | entry.push(Arc::new(hook)); |
| 184 | entry.sort_by(|a, b| b.priority.cmp(&a.priority)); |
| 185 | } |
| 186 | |
| 187 | pub async fn trigger(&self, context: HookContext) -> Vec<HookResult> { |
| 188 | let hooks = self.hooks.read().await; |
no test coverage detected