Skip to main content

generate_r_wrapper_for_slot

Function generate_r_wrapper_for_slot 

Source
fn generate_r_wrapper_for_slot(
    class_system: ClassSystem,
    type_name: &str,
    field_name: &str,
    getter_c_name: &str,
    setter_c_name: &str,
) -> String
Expand description

Generate R wrapper code (roxygen-annotated R functions) for a single sidecar slot.

Produces getter and setter R functions that call the corresponding C entry points via .Call. The generated R code includes roxygen tags (@rdname, @param, @return, @export) for documentation.

All class systems generate the same standalone function pattern (Type_get_field / Type_set_field); only the roxygen title suffix differs. Class-specific integration (e.g., R6 active bindings, S7 properties) is handled separately by generate_class_integration_r_code.

Each wrapper body carries the shared tagged-condition guard (crate::method_return_builder::standalone_body) so Rust-origin panics/conversion failures are re-raised as structured R conditions. Note the sidecar C functions have no .call slot — the .Call() must not pass .call = match.call() (#344/#348); sys.call() inside the guard supplies fallback attribution instead.