pub fn with_hook_context<F, R>(context: HookContext, f: F) -> Rwhere
F: FnOnce() -> R,Expand description
Runs a closure with the given HookContext set as the active context.
Saves the previous context, sets the new one, executes the closure, and restores the previous context afterward.
§Arguments
HookContext: The hook context to set as active during closure execution.F: The closure to execute with the given context.
§Returns
R: The result of the closure execution.