unsafe fn sidecar_receiver<T: TypedExternal>(x: SEXP) -> SEXPExpand description
The external pointer an R accessor’s receiver x carries: x itself, or
the pointer an R6 / S4 / S7 handle, an environment or a list holds in
.ptr, the shapes an instance method’s receiver takes
(unwrap_class_handle). So Type_get_f(x) and the $ / [[ field
methods of r_data_accessors read a list that carries the handle (#1848).
A bare pointer costs one TYPEOF compare; an S4 receiver reads its ptr
slot through methods::slot(), which allocates. The pointer is reachable
from x, which the caller’s .Call() frame roots.
§Panics
When x carries no external pointer, with the classed
NO_HANDLE_CLASS error (refuse_no_handle).
§Safety
Must be called from R’s main thread with a valid x.