Expand description
Panic-safety helpers for the C ABI boundary.
Rust panics that unwind across extern "C" into Swift are undefined
behaviour. Every extern callback in this crate that invokes user code
must wrap that invocation in catch_user_panic, which catches the
panic, logs a best-effort diagnostic to stderr, and never returns a
panic to its caller.
This is intentionally a single shared helper rather than ad-hoc
catch_unwind calls so the diagnostic format and the
“stderr-write itself might panic” defence-in-depth stay consistent.
Functions§
- catch_
user_ panic - Run
fand swallow any panic it produces. - log_
callback_ panic - Best-effort logger for panics caught at the C ABI boundary.