Skip to main content

call_sync

Function call_sync 

Source
pub unsafe fn call_sync<R: Sentinel>(
    out_err: *mut FfiError,
    body: impl FnOnce() -> Result<R, FfiError>,
) -> R
Expand description

Run a synchronous thunk’s body and report its outcome: Ok clears out_err and returns the value; Err stores the error and returns the Sentinel; a panic is caught and reported with the panic code, so it never unwinds into C.

§Safety

out_err must be null or point to a valid, writable error slot whose pointers are null or owned by this runtime.