Skip to main content

guarded_altrep_call

Function guarded_altrep_call 

Source
fn guarded_altrep_call<T: Altrep, F, R>(f: F) -> R
where F: FnOnce() -> R,
Expand description

Dispatch an ALTREP callback through the guard mode selected by T::GUARD.

Since T::GUARD is a const, the compiler eliminates the unreachable branches at monomorphization time — zero runtime overhead for the chosen mode.

  • Unsafe: No protection — the closure runs directly.
  • RustUnwind: Wraps in catch_unwind, converting panics to Rf_error so they don’t unwind through C frames.
  • RUnwind: Wraps in R_UnwindProtect, catching both Rust panics and R longjmps safely.