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_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.
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.
split_choice_list 🔒
Split a comma-separated choices list (as given to choices(param = "a, b, c")) into individual trimmed entries. Surrounding double-quotes are tolerated so users can spell the list either way: "a, b" or "\"a\", \"b\"".