Expand description
Shared utilities for R class wrapper generation.
This module provides abstractions to reduce duplication across the 5 class system generators (Env, R6, S3, S4, S7). Each class system has different R idioms but shares common patterns:
- Class-level roxygen documentation
- Constructor generation
- Instance method iteration with
.Call()building - Static method handling
- Return strategy application
§Architecture
ParsedImpl
│
├─▶ ClassDocBuilder → roxygen header lines (#' @title, @name, etc.)
│
└─▶ MethodContext[] → pre-computed method data for each method
│
└─▶ ClassFormatter::format_constructor()
└─▶ ClassFormatter::format_instance_method()
└─▶ ClassFormatter::format_static_method()Structs§
- Class
DocBuilder - Builder for class-level roxygen documentation header.
- Method
Context - Pre-computed context for a method, holding all data needed for R wrapper generation.
- Method
DocBuilder - Builder for method-level roxygen documentation.
Traits§
- Parsed
Impl Ext - Extension trait for
ParsedImplto iterate over methods asMethodContext.
Functions§
- class_
ref_ 🔒or_ verbatim - Return a
.__MX_CLASS_REF_<name>__placeholder (for bare identifiers) so the resolver can look up the actual R class name at cdylib write time, ornameverbatim (for namespaced / non-identifier strings). - effective_
r_ 🔒defaults - Effective R-formal defaults for a method.
- emit_
s3_ 🔒generic_ guard - Emit the conditional S3 generic guard for a given generic name.
- is_
bare_ 🔒identifier - Check whether
sis a bare R identifier (only[A-Za-z_][A-Za-z0-9_]*). - match_
arg_ 🔒doc_ placeholder_ map - Build the R-param-name → @param placeholder map for a method’s match_arg and
choices params. Pass to
MethodDocBuilder::with_match_arg_doc_placeholdersin each class generator. - should_
export_ 🔒from_ tags - Determine whether a class or method should be
@export-ed.