fn run_r_unwind_protect<F, R>(f: F) -> Result<R, Box<dyn Any + Send>>where
F: FnOnce() -> R,Expand description
Core R_UnwindProtect wrapper. Returns Ok(result) on success,
Err(payload) on Rust panic, or diverges via R_ContinueUnwind on R longjmp.
Handles: CallData boxing, trampoline, cleanup handler, continuation token,
Box::from_raw reclamation on all non-diverging paths.
Drains the cross-thread log queue (when the log feature is enabled) at
each exit point so worker-thread records reach R’s console before the FFI
boundary is crossed.