Skip to main content

generate_trait_env_r_wrapper

Function generate_trait_env_r_wrapper 

Source
fn generate_trait_env_r_wrapper(
    type_ident: &Ident,
    trait_name: &Ident,
    methods: &[TraitMethod],
    consts: &[TraitConst],
    impl_preconditions: Option<bool>,
) -> String
Expand description

Generate Env-style R wrapper code for trait methods.

Env-class trait methods use a namespace hierarchy: Type$Trait$method(.mx_self, ...). Instance methods take .mx_self as the first parameter (the self object) and are stamped with .__mx_instance__ attribute for $ dispatch detection. Void instance methods return the receiver for pipe-friendly chaining (invisibly only when marked Invisible<..>, #1213).

Static methods and constants also live under Type$Trait$name. A method has no \usage, so its block is documented like an env inherent method’s (namespace_member_body_lines).