Skip to main content

generate_trait_s7_r_wrapper

Function generate_trait_s7_r_wrapper 

Source
fn generate_trait_s7_r_wrapper(
    type_ident: &Ident,
    trait_name: &Ident,
    methods: &[TraitMethod],
    consts: &[TraitConst],
) -> String
Expand description

Generate S7-style R wrapper code.

For impl Counter for SimpleCounter, generates:

  • S7 S3-class wrapper: .s7_class_SimpleCounter <- S7::new_S3_class("SimpleCounter")
  • S7 generic: s7_trait_Counter_value <- S7::new_generic(...) (if not exists)
  • S7 method registration: S7::method(s7_trait_Counter_value, .s7_class_SimpleCounter) <- ...

Generic names are prefixed with s7_trait_{Trait}_ to avoid collisions. Static methods and constants use Type$Trait$name namespace (env-style).