pub fn generate_r6_class(parsed_impl: &ParsedImpl) -> ClassWrapperExpand description
Generates the R wrapper of an R6-style class, in the parts the wrapper
writer merges per type (super::ClassWrapper, #1776).
Produces an R6::R6Class(...) core definition followed by per-method
$set() blocks (see the module docs for the full $set-form shape, #369):
initializemethod (inline inpublic): calls the Rust constructor, or accepts a pre-made.ptrwhen a factory returnsSelf; a class without a constructor accepts only the.ptrand raises the no-constructor error without one- Public methods: one
ClassName$set("public", "name", function(...) {...})block per&self/&mut selfinstance method, each with its own roxygen - Private methods: one
ClassName$set("private", "name", function(...) {...})block per method marked with#[miniextendr(private)] - Active bindings: one
ClassName$set("active", "name", function(...) {...})block per getter/setter property (#[miniextendr(r6(prop = "..."))]) - Private
.ptrfield (inline inprivate): holds theExternalPtrto the Rust struct - Finalizer (
$set("private", "finalize", ...)): optional destructor called when the R6 object is garbage-collected - Deep clone (
$set("private", "deep_clone", ...)): optional custom clone logic via#[miniextendr(r6(deep_clone))] - Static methods: emitted as
ClassName$method_name <- function(...)outside the class - Class options:
lock_objects,lock_class,cloneable,portable,inherit
Also generates roxygen2 documentation blocks for the class, its methods, and active bindings.
The R6Class() core is the head; the $set() blocks and the static
methods are the members; the sidecar active bindings and $lock() are the
tail, after every block’s $set().