#[non_exhaustive]pub struct FfiBoundary;Expand description
Panic-safe entry point shared by every extern "C" callback this crate
exposes. Zero-sized; the methods are associated functions grouped here by
responsibility.
Implementations§
Source§impl FfiBoundary
impl FfiBoundary
Sourcepub fn run<F>(f: F) -> i32
pub fn run<F>(f: F) -> i32
Run f inside catch_unwind and project the outcome to a MySQL
HA_ERR_* integer suitable for an extern "C" return:
Ok(Ok(()))→0Ok(Err(e))→e.to_mysql_errno()Err(_)(panic) →HA_ERR_INTERNAL_ERROR
#[inline] lets the per-callback wrapping fold into each
rust__handler__* site; see benches/callback_overhead/ for
the per-call measurements that justify the hint.
Sourcepub fn run_void<F>(f: F)where
F: FnOnce(),
pub fn run_void<F>(f: F)where
F: FnOnce(),
Variant for callbacks whose C++ signature returns void. Panics are swallowed (and logged) so the server stays alive; errors cannot be reported back to MySQL through a void return.
#[inline] lets the per-callback wrapping fold into each
rust__handler__* site; see benches/callback_overhead/ for
the per-call measurements that justify the hint.
Sourcepub fn run_default<T, F>(default: T, f: F) -> Twhere
F: FnOnce() -> T,
pub fn run_default<T, F>(default: T, f: F) -> Twhere
F: FnOnce() -> T,
Variant for callbacks that return a non-Result value (pointer, flag
bitfield, etc.). Returns default on panic so the C++ side always
observes a well-defined value rather than an unwound stack.
#[inline] lets the per-callback wrapping fold into each
rust__handler__* site; see benches/callback_overhead/ for
the per-call measurements that justify the hint.