pub fn generate_s3_r_wrapper(parsed_impl: &ParsedImpl) -> StringExpand description
Generates the complete R wrapper string for an S3-style class.
Produces the following R code:
- Constructor:
new_<class>(...)function that calls the Rustnewconstructor and wraps the result withstructure(.val, class = "<class>") - S3 generics: for each instance method, a
UseMethod()generic is created (unless overriding an existing generic via#[miniextendr(generic = "...")]) - S3 methods:
<generic>.<class>functions dispatching to the Rust.Call()wrapper, with the ExternalPtr extracted fromx - Static methods: regular functions named
<class>_<method>(...) - Class environment:
ClassName <- new.env(parent = emptyenv())forClass$new()syntax and trait namespace compatibility
Custom double-dispatch patterns (e.g., vec_ptype2.a.b) are supported via
#[miniextendr(generic = "...", class = "...")] attributes.