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
RArgumentBuilder: Builds R formals and.Call()arguments from Rust signaturesDotCallBuilder: Formats.Call()invocations with proper argument handlingRoxygenBuilder: Generates roxygen2 documentation tags
§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§
- DotCall
Builder - Builder for formatting
.Call()invocations in R wrapper code. - RArgument
Builder - Builder for R function formal parameters and call arguments.
- Roxygen
Builder - 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_identthat skips thesyn::Identround-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\"".