Skip to main content

altstring_cache

Function altstring_cache 

Source
unsafe fn altstring_cache(x: SEXP, n: R_xlen_t) -> SEXP
Expand description

Return a bridge string ALTREP’s data2 element cache, allocating it on first use.

Slots not computed yet hold C NULL, as in R’s own deferred string class (altclasses.c). NA_character_ is therefore an ordinary cached value, so an NA that R writes through Set_elt or Dataptr stays NA. Every CHARSXP handed to R stays reachable from x, as R code expects of STRING_ELT.

§Safety

x must be a live ALTSTRING using the bridge’s data2 convention, on R’s main thread.