pub fn generate_method_c_wrapper(
parsed_impl: &ParsedImpl,
method: &ParsedMethod,
r_wrappers_const: &Ident,
) -> TokenStreamExpand description
Generate a C-callable wrapper function for a single method in an impl block.
Produces a #[no_mangle] extern "C" function named C_{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
Thread strategy is determined automatically: instance methods always run on the main
thread (because self_ref is a non-Send borrow), while static methods use the worker
thread unless unsafe(main_thread) is specified.
Also emits an R_CallMethodDef constant for R routine registration, and appends
generated R wrapper code fragments to the r_wrappers_const string constant.
ยงArguments
parsed_impl- The parsed impl block providing type identity, cfg attrs, and optionsmethod- The parsed method to generate a wrapper forr_wrappers_const- Identifier of the const that accumulates R wrapper code fragments