Skip to main content

generate_sidecar_accessors

Function generate_sidecar_accessors 

Source
fn generate_sidecar_accessors(
    input: &DeriveInput,
    info: &SidecarInfo,
) -> Result<TokenStream>
Expand description

Generate sidecar accessor constants and extern "C-unwind" functions.

For each public #[r_data] field, generates:

  • A getter FFI function (C__mx_rdata_get_Type_field)
  • A setter FFI function (C__mx_rdata_set_Type_field)
  • R_CallMethodDef entries for routine registration
  • R wrapper function code (roxygen-documented)
  • Class-integration code for R6 / S7 (active bindings / properties)

The generated constants are:

  • RDATA_CALL_DEFS_{TYPE}: slice of R_CallMethodDef for registration
  • R_WRAPPERS_RDATA_{TYPE}: string literal of R wrapper code

Returns Err if the struct has generic type parameters (.Call entrypoints cannot be generic).