Expand description
R wrapper generation for trait methods across all class systems.
Each class system (Env, S3, S4, S7, R6, Vctrs) has its own generator that
produces R code strings for instance methods, static methods, and associated
constants. The top-level generate_trait_r_wrapper dispatches to the
appropriate generator and applies post-processing for export/documentation control.
Structs§
- Trait
Wrapper 🔒Opts - Options controlling export visibility and documentation for trait R wrapper generation.
Constants§
- PAGE_
TAGS 🔒 - The author tags of a trait-impl method that its own wrapper block
forwards besides the
@paramlines: the tags that decide the method’s page and where its arguments are documented.@describeIn/@rdnameroute the block,@namenames its topic,@ordersorts it, and@inheritParams/@inherit/@inheritDotParamsfill its arguments. Env trait methods and the namespace statics of S3, vctrs and S7 forward every other tag but@titleand a bare@exporttoo (forwarded_body_tag); S4 statics get@paramlines (param_doc_tags).
Functions§
- check_
trait_ 🔒method_ formals - Check the R formals of every trait method
(
check_r_formals). Every dispatching class system defaults an instance method’s receiver tox. S3/S4 existing-generic overrides can select another receiver. S7 shortcuts and Env/R6 trait methods use the injected receiver.mx_self, which cannot be spelled by a Rust parameter. - describes_
in 🔒 - Whether the method-level
@describeInlists the method’s own block in its destination’s “Functions” section. - finish_
instance_ 🔒body - Close an instance-method body (#1213).
- forwarded_
body_ 🔒tag - Whether the body of a block without
\usage(an env trait method, aType$Trait$methodstatic of S3 and vctrs, anattr(Type, "Trait")$methodstatic of S7) forwards the author tagtag: every tag but thePAGE_TAGS, whichown_block_page_linesforwards,@title, which the structural split-page title owns, and a bare@export, which would export the member itself (forwarded_member_tag). The@paramlines become items of the block’s\describe{}list. - generate_
trait_ 🔒env_ r_ wrapper - Generate Env-style R wrapper code for trait methods.
- generate_
trait_ 🔒r6_ r_ wrapper - Generate R6-style R wrapper code.
- generate_
trait_ 🔒r_ wrapper - Generate R wrapper code for trait methods and consts, dispatching by class system.
- generate_
trait_ 🔒s3_ r_ wrapper - Generate S3-style R wrapper code (generic + method.Type).
- generate_
trait_ 🔒s4_ r_ wrapper - Generate S4-style R wrapper code.
- generate_
trait_ 🔒s7_ r_ wrapper - Generate S7-style R wrapper code.
- joins_
author_ 🔒topic - Whether the method’s page is an author topic other than the type page
(
@describeIn, or an@rdnamenaming another page). The topic’s own block documents that page, so the method’s blocks sort after it (@order NaN) and leave the structural@paramlines (x,...,self) and generated prose to it. - method_
page 🔒 - The page a trait method’s own block lands on, and with it the companion
block that must share it (the S3 generic block, named after the method):
the
@describeIndestination, the method-level@rdname, else the type’s shared page. Generics of S4 / S7 and consts always use the type page. - namespace_
member_ 🔒body_ lines - The documentation body of a block without
\usage(seeforwarded_body_tag), documented like an env inherent method: the forwarded author tags, then one\describe{}list with the author’s@paramitems and the choice text of the parameters they leave undocumented (describe_params_lines).labelis the block’s topic name, used in the list’s lead-in. Empty for a method with no doc comment and no choice parameter. - own_
block_ 🔒page_ lines - The page lines of a trait method’s own wrapper block, as
MethodDocBuilderwrites an inherent method’s (#1590): - param_
doc_ 🔒tags - The
@paramtags of a block that documents the method’s arguments in a\usage(an S3 / vctrs instance method, an S4 static): the author’s@paramlines, then one per formal ofctx.paramsthey leave undocumented, with its choice text for a choice parameter and(undocumented)otherwise. A method whose arguments another block documents (an author topic,@inheritParams) gets no generated tag (#1590). - param_
tags 🔒 - The
@paramlines of the method’s doc comment. - params_
documented_ 🔒elsewhere - Whether the method’s arguments are documented by another block: it joins
an author topic, or inherits them (
@inheritParams,@inherit). The generated(undocumented)fillers are left out then. - push_
param_ 🔒tags - Push the method’s
@paramlines, each continuation line with its own#'lead. - reject_
unsupported_ 🔒describe_ in - Reject a method-level
@describeInthat roxygen2 cannot honour on the trait wrapper (#1590), the ruleParsedImpl::reject_unsupported_describe_inapplies to inherent methods.