Skip to main content

Module r_wrapper_builder

Module r_wrapper_builder 

Source
Expand description

Shared utilities for building R wrapper code.

This module provides builders for constructing R function signatures and call arguments consistently across both standalone functions and impl methods.

§Key Components

§Usage

// Build R function signature
let formals = build_r_formals_from_sig(&method.sig, &defaults);
let call_args = build_r_call_args_from_sig(&method.sig);

// Build .Call() invocation
let call = DotCallBuilder::new("C_MyType__method")
    .with_self("self")
    .with_args(&["x", "y"])
    .build();

// Build roxygen tags
let tags = RoxygenBuilder::new("MyType")
    .name("method")
    .rdname("MyType")
    .export()
    .build();

Structs§

DotCallBuilder
Builder for formatting .Call() invocations in R wrapper code.
RArgumentBuilder
Builder for R function formal parameters and call arguments.
RoxygenBuilder
Builder for generating roxygen2 documentation tags.

Functions§

build_missing_prelude
Build if (missing(param)) param <- quote(expr=) prelude lines for Missing<T> parameters.
build_r_call_args_from_sig 🔒
Build R .Call() arguments from a Rust function signature.
build_r_formals_from_sig 🔒
Build R formal parameters from a Rust function signature, with optional defaults.
collect_missing_params
Collect parameter names that have Missing<T> types.
collect_param_idents 🔒
Collect parameter identifiers from a function signature.
is_missing_type 🔒
Check if a type is Missing<T> by examining the last path segment.
normalize_r_arg_ident
Normalizes Rust argument identifiers for R.
normalize_r_arg_string
String form of normalize_r_arg_ident that skips the syn::Ident round-trip.