Skip to main content

altrep_region_buf

Function altrep_region_buf 

Source
pub unsafe fn altrep_region_buf<T>(buf: *mut T, len: usize) -> &'static mut [T]
Expand description

Create a mutable slice from an ALTREP get_region output buffer pointer.

Called by the bridge trampolines (altrep_bridge.rs) to convert the raw *mut T buffer from R’s ALTREP dispatch into a &mut [T] before passing it to the trait methods.

§Safety

  • buf must be a valid, aligned, writable pointer to at least len elements of T.
  • The caller must ensure no aliasing references to the same memory exist.
  • This is guaranteed when called from R’s ALTREP Get_region dispatch, which provides a freshly allocated buffer.