pub enum AltrepGuard {
Unsafe,
RustUnwind,
RUnwind,
}Expand description
Controls the panic/error guard used around ALTREP trampoline callbacks.
Each mode trades off safety vs performance:
-
Unsafe: No protection. If the callback panics, behavior is undefined (unwinding through C frames). Use only for trivial callbacks that cannot panic. -
RustUnwind: Wraps incatch_unwind, converting Rust panics to R errors. This is the default and safe for all pure-Rust callbacks. Overhead: ~1-2ns per call. -
RUnwind: Wraps inR_UnwindProtect, catching both Rust panics and Rlongjmperrors. Use when ALTREP callbacks invoke R API functions that might error (e.g.,Rf_allocVector,Rf_eval).
The guard is selected via the const GUARD associated constant on the Altrep
trait. Since it is a const, the compiler eliminates dead branches at
monomorphization time — zero runtime overhead for the chosen mode.
Variants§
Unsafe
No protection. Fastest, but if the callback panics, behavior is undefined.
RustUnwind
catch_unwind — catches Rust panics, converts to R errors. Default.
RUnwind
with_r_unwind_protect — catches both Rust panics and R longjmps.
Use when ALTREP callbacks invoke R API functions that might error.
Trait Implementations§
Source§impl Clone for AltrepGuard
impl Clone for AltrepGuard
Source§fn clone(&self) -> AltrepGuard
fn clone(&self) -> AltrepGuard
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more