Skip to main content

duplicate_altrep_data2

Function duplicate_altrep_data2 

Source
#[doc(hidden)]
pub unsafe fn duplicate_altrep_data2(data2: SEXP) -> SEXP
Expand description

Copy a bridge ALTREP’s data2 for a Duplicate callback.

A string cache can hold C NULL slots, which Rf_duplicate can’t copy: it stores every slot with SET_STRING_ELT. Its copy keeps those slots empty, so the new vector computes them from its own Rust data, and keeps the written mark. Any other data2 (a materialized vector) goes through Rf_duplicate.

§Safety

data2 is a live ALTREP’s data2, kept reachable by the caller, on R’s main thread. The result is unprotected.