Skip to main content

refuse_restored

Function refuse_restored 

Source
pub(crate) unsafe fn refuse_restored<T: TypedExternal>(
    sexp: SEXP,
    receiver: SEXP,
) -> NullAddress
Expand description

Raises the error for a pointer without an address when it was built for T (by this version: RESTORED_NO_VALUE_CLASS; by another: RESTORED_OTHER_VERSION_CLASS), with the package’s classes in front and its message when the type declares them (#[externalptr(restored(...))]), and returns the other cases for the caller to word as it did before. The default message names receiver’s R class, the object the user called on (the pointer itself, or the list, environment or S4 object carrying it), else the Rust type. The condition is raised through the panic transport (panic_any), like error!.

§Safety

Must be called from R’s main thread with a valid EXTPTRSXP whose address is NULL.