Skip to main content

generate_class_integration_r_code

Function generate_class_integration_r_code 

Source
fn generate_class_integration_r_code(
    class_system: ClassSystem,
    type_name: &str,
    pub_slots: &[&SidecarSlot],
    field_error: &FieldErrorOptions,
) -> String
Expand description

Generate class-integrated R code for sidecar fields.

For R6: generates Type$set("active", "field", ...) calls that add active bindings referencing the sidecar getter/setter .Call entrypoints. The binding of a field without an R setter (a Computed or #[r_data(read_only)] one) refuses a value, as R6’s own read-only active bindings do (#1888, #2268): see r6_read_only_refusal.

For S7: generates .rdata_properties_Type <- list(...) with S7::new_property() definitions that can be spliced into the S7 class’s properties list. A field without an R setter is a property without a setter, which S7 itself refuses to assign (#1888, #2268).

Other class systems return empty strings (their standalone accessors suffice).