usestd::mem;usestd::process;/// Calls a function and aborts if it panics.
////// This is useful in unsafe code where we can't recover from panics.
#[inline]pubfnabort_on_panic<T>(f: impl FnOnce() -> T)-> T{structBomb;implDrop forBomb{fndrop(&mutself){process::abort();}}let bomb = Bomb;let t =f();mem::forget(bomb);
t
}