Function try_catch

Source
pub fn try_catch<R, F: FnMut() -> R + RefUnwindSafe>(
    func: F,
) -> Result<R, CatchError>
Expand description

PHP propose a try catch mechanism in C using setjmp and longjmp (bailout) It store the arg of setjmp into the bailout field of the global executor If a bailout is triggered, the executor will jump to the setjmp and restore the previous setjmp

try_catch allow to use this mechanism

ยงReturns

  • Ok(R) - The result of the function
  • Err(CatchError) - A bailout occurred during the execution