Skip to main content

generate_as_coercion_methods

Function generate_as_coercion_methods 

Source
pub fn generate_as_coercion_methods(parsed_impl: &ParsedImpl) -> String
Expand description

Generate R S3 method wrappers for as.<class>() coercion methods.

For each method with #[miniextendr(as = "...")], generates an S3 method like:

#' @export
#' @method as.data.frame MyType
as.data.frame.MyType <- function(x, ...) {
    .Call(C_MyType__as_data_frame, .call = match.call(), x)
}

This function is called by each class system generator to append the as.* methods to the R wrapper output.