MCPcopy Create free account
hub / github.com/hashintel/hash / insert

Method insert

libs/error-stack/src/fmt/hook.rs:432–442  ·  view source on GitHub ↗
(
        &mut self,
        hook: impl Fn(&T, &mut HookContext<T>) + Send + Sync + 'static,
    )

Source from the content-addressed store, hash-verified

430
431impl 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;

Callers 15

loadBlockFromUrlFunction · 0.45
verify_truth_tableFunction · 0.45
get_samplesFunction · 0.45
executeMethod · 0.45
executeMethod · 0.45
executeMethod · 0.45
executeMethod · 0.45
executeMethod · 0.45
executeMethod · 0.45
generate_propertiesFunction · 0.45

Calls 3

into_boxed_hookFunction · 0.85
pushMethod · 0.65
retainMethod · 0.45

Tested by

no test coverage detected