fn generate_getter_body(
struct_name: &Ident,
slot: &SidecarSlot,
_prot_index_lit: &LitInt,
) -> TokenStreamExpand description
Generate the token stream for a sidecar getter function body.
Reads the field value from the Rust struct (accessed via the external pointer address) and converts it to an R SEXP. The conversion strategy depends on the slot kind:
RawSexp: returns the SEXP field directly.- Scalar kinds: wraps in
Rf_Scalar*for zero-overhead conversion. Conversion: clones the value and callsIntoR::into_sexp.
The body runs inside with_r_unwind_protect (see the emission site in
generate_sidecar_accessors); a non-external-pointer argument, a null
pointer address, or a wrong stored type panics with the same
expected ExternalPtr<T> message the main class-method path uses. The
panic is transported as a tagged condition and re-raised by the R wrapper.