Skip to main content

abort_on_panic

Function abort_on_panic 

Source
pub fn abort_on_panic<F, R>(f: F) -> R
where F: FnOnce() -> R,
Expand description

Executes f, aborting the process if it panics.

FFI exports always call this helper so a panic never unwinds across the extern "C" boundary. Unwinding into C/Python is undefined behaviour and can silently corrupt the foreign stack; aborting instead preserves the fail-fast guarantee with effectively no debugging downside (the panic message is still logged before the abort).