Function catch_unwind::catch_unwind_with_arg
source · pub fn catch_unwind_with_arg<F, A, R>(f: F, arg: A) -> Result<R, KillReason>where
F: FnOnce(A) -> R,
Expand description
Invokes the given closure f
, catching a panic as it is unwinding the stack.
Returns Ok(R)
if the closure f
executes and returns successfully,
otherwise returns Err(cause)
if the closure panics, where cause
is the original cause of the panic.
This function behaves similarly to the libstd version, so please see its documentation here: https://doc.rust-lang.org/std/panic/fn.catch_unwind.html.