Skip to main content

guarded_ffi_call

Function guarded_ffi_call 

Source
pub fn guarded_ffi_call<F, R>(f: F, mode: GuardMode, source: PanicSource) -> R
where F: FnOnce() -> R,
Expand description

Execute f inside an FFI guard selected by mode.

On panic:

§Parameters

  • f: The closure to execute.
  • mode: Which guard strategy to use.
  • source: Attribution for telemetry if a panic occurs.

§Note on fallback

GuardMode::CatchUnwind diverges on panic (Rf_error never returns), so no fallback value is needed. If you need a fallback (e.g. connection trampolines that must return a value on panic without calling R), use guarded_ffi_call_with_fallback instead.