pub struct PanicHookGuard;Expand description
Activates the classifying panic hook on the calling thread for as long as it is held, installing it on first use.
Held around contract code and nothing else: by trampoline around the mock
body it invokes, and by MockInvocationFrame::execute around the lambda
standing in for a frame’s body. A panic outside those is a harness bug, and
keeps the default output and an unrecoverable code – which is why the real
FFI call in TransactionHandler::root_invoke holds no guard.
trampoline holding it is also what makes the mark land on the right
thread: execution is coroutinized, so a body runs on whichever pool thread
resumed it, but trampoline and the body it calls are always the same one.
A count, not a flag, since these nest: a frame’s lambda invokes bodies, and a body can invoke another contract. Decrements on drop, so an unwinding body still leaves the count balanced.