pub fn generate_method_c_wrapper(
parsed_impl: &ParsedImpl,
method: &ParsedMethod,
) -> TokenStreamExpand description
Generate a C-callable wrapper function for a single method in an impl block.
Produces a #[no_mangle] extern "C-unwind" function named C_{crate}_{Type}__{method} that:
- Accepts SEXP arguments (including
self_sexpfor instance methods) - Extracts
&self/&mut selffrom anErasedExternalPtrfor instance methods - Converts SEXP arguments to Rust types
- Calls the actual Rust method
- Converts the return value back to SEXP
The wrapper runs on R’s main thread.
Also emits an R_CallMethodDef constant for R routine registration.
§Arguments
parsed_impl- The parsed impl block providing type identity, cfg attrs, and optionsmethod- The parsed method to generate a wrapper for