Skip to main content

guard_or_null

Function guard_or_null 

Source
pub fn guard_or_null<T>(thunk_name: &str, f: impl FnOnce() -> *mut T) -> *mut T
Expand description

Runs a closure under catch_unwind for thunks that return a raw pointer where null already signals failure (create, clone_handle).

On panic, logs the message and returns null so the host can surface a recoverable error instead of the process aborting.