(
&mut self,
hook: impl Fn(&T, &mut HookContext<T>) + Send + Sync + 'static,
)
| 430 | |
| 431 | impl Hooks { |
| 432 | pub(crate) fn insert<T: Send + Sync + 'static>( |
| 433 | &mut self, |
| 434 | hook: impl Fn(&T, &mut HookContext<T>) + Send + Sync + 'static, |
| 435 | ) { |
| 436 | let type_id = TypeId::of::<T>(); |
| 437 | |
| 438 | // make sure that previous hooks of the same TypeId are deleted. |
| 439 | self.inner.retain(|(id, _)| *id != type_id); |
| 440 | // push new hook onto the stack |
| 441 | self.inner.push((type_id, into_boxed_hook(hook))); |
| 442 | } |
| 443 | |
| 444 | pub(crate) fn call(&self, frame: &Frame, context: &mut HookContext<Frame>) -> bool { |
| 445 | let mut hit = false; |
no test coverage detected