Skip to main content

AltrepSexpExt

Trait AltrepSexpExt 

Source
pub trait AltrepSexpExt {
    // Required methods
    unsafe fn altrep_data2_raw(&self) -> SEXP;
    unsafe fn altrep_data2_raw_unchecked(&self) -> SEXP;
    unsafe fn set_altrep_data2(&self, data2: SEXP);
    unsafe fn set_altrep_data2_unchecked(&self, data2: SEXP);
}
Expand description

ALTREP-specific extension methods for SEXP.

These methods wrap the free functions in ffi::altrep, converting func(x) calls to x.method() calls. This avoids the clippy::not_unsafe_ptr_arg_deref lint in ALTREP trait method implementations that receive SEXP as a parameter.

Only data2 (cache) accessors are exposed here; data1 (storage) is accessed via the AltrepExtract trait or the standalone free functions altrep_data1_as / altrep_data1_as_unchecked / altrep_data1_mut / altrep_data1_mut_unchecked.

Required Methods§

Source

unsafe fn altrep_data2_raw(&self) -> SEXP

Get the raw SEXP in the ALTREP data2 slot.

§Safety
  • self must be a valid ALTREP SEXP
  • Must be called from the R main thread
Source

unsafe fn altrep_data2_raw_unchecked(&self) -> SEXP

Get the ALTREP data2 slot (unchecked — no thread routing).

§Safety
  • self must be a valid ALTREP SEXP
  • Must be called from the R main thread
Source

unsafe fn set_altrep_data2(&self, data2: SEXP)

Set the ALTREP data2 slot.

§Safety
  • self must be a valid ALTREP SEXP
  • Must be called from the R main thread
Source

unsafe fn set_altrep_data2_unchecked(&self, data2: SEXP)

Set the ALTREP data2 slot (unchecked — no thread routing).

§Safety
  • self must be a valid ALTREP SEXP
  • Must be called from the R main thread

Implementors§