pub fn catch_oom<F: FnOnce() -> R + UnwindSafe, R>(
f: F,
) -> Result<R, AllocError>
Expand description
Invokes a closure, capturing the out-of-memory panic if one occurs.
This function will return Ok
with the closure’s result if the closure
does not panic, and will return AllocError
if allocation error occurs. The
process will abort if other panics occur.