Skip to main content

generate_trait_r_wrapper

Function generate_trait_r_wrapper 

Source
pub(super) fn generate_trait_r_wrapper(
    type_ident: &Ident,
    trait_name: &Ident,
    methods: &[TraitMethod],
    consts: &[TraitConst],
    opts: TraitWrapperOpts,
) -> Result<String>
Expand description

Generate R wrapper code for trait methods and consts, dispatching by class system.

Calls the appropriate class-system-specific generator (env, s3, s4, s7, r6), then applies post-processing for @noRd, internal, and noexport options:

  • class_has_no_rd: Strips roxygen blocks (for S3/vctrs, keeps @method/@export tags)
  • internal: Replaces @export/@exportMethod with @keywords internal
  • noexport: Removes @export/@exportMethod entirely

Returns the complete R wrapper code as a string ready for embedding in a const.