Function core::intrinsics::catch_unwind
source · pub unsafe extern "rust-intrinsic" fn catch_unwind(
try_fn: fn(_: *mut u8),
data: *mut u8,
catch_fn: fn(_: *mut u8, _: *mut u8),
) -> i32
🔬This is a nightly-only experimental API. (
core_intrinsics
)Expand description
Rust’s “try catch” construct for unwinding. Invokes the function pointer try_fn
with the
data pointer data
, and calls catch_fn
if unwinding occurs while try_fn
runs.
catch_fn
must not unwind.
The third argument is a function called if an unwind occurs (both Rust unwinds and foreign
unwinds). This function takes the data pointer and a pointer to the target-specific
exception object that was caught. For more information, see the compiler’s source as well as
std’s catch_unwind
implementation.
The stable version of this intrinsic is std::panic::catch_unwind
.