pub trait AltrepSexpExt {
// Required methods
unsafe fn altrep_data1<T: TypedExternal>(&self) -> Option<ExternalPtr<T>>;
unsafe fn altrep_data1_mut_ref<T: TypedExternal>(
&self,
) -> Option<&'static mut T>;
unsafe fn altrep_data2(&self) -> SEXP;
unsafe fn set_altrep_data2(&self, data2: SEXP);
}Expand description
ALTREP-specific extension methods for SEXP.
These methods wrap the free functions in externalptr::altrep_helpers
and 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.
Required Methods§
Sourceunsafe fn altrep_data1<T: TypedExternal>(&self) -> Option<ExternalPtr<T>>
unsafe fn altrep_data1<T: TypedExternal>(&self) -> Option<ExternalPtr<T>>
Extract the ALTREP data1 slot as a typed ExternalPtr<T>.
§Safety
selfmust be a valid ALTREP SEXP- Must be called from the R main thread
Sourceunsafe fn altrep_data1_mut_ref<T: TypedExternal>(
&self,
) -> Option<&'static mut T>
unsafe fn altrep_data1_mut_ref<T: TypedExternal>( &self, ) -> Option<&'static mut T>
Get a mutable reference to data in the ALTREP data1 slot.
§Safety
selfmust be a valid ALTREP SEXP- Must be called from the R main thread
- The caller must ensure no other references to the data exist
Sourceunsafe fn altrep_data2(&self) -> SEXP
unsafe fn altrep_data2(&self) -> SEXP
Get the ALTREP data2 slot.
§Safety
selfmust be a valid ALTREP SEXP- Must be called from the R main thread
Sourceunsafe fn set_altrep_data2(&self, data2: SEXP)
unsafe fn set_altrep_data2(&self, data2: SEXP)
Set the ALTREP data2 slot.
§Safety
selfmust be a valid ALTREP SEXP- Must be called from the R main thread
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.