Skip to main content

build_missing_prelude

Function build_missing_prelude 

Source
pub fn build_missing_prelude(
    inputs: &Punctuated<FnArg, Comma>,
    user_defaults: &HashMap<String, String>,
) -> Vec<String>
Expand description

Build if (missing(param)) param <- quote(expr=) prelude lines for Missing<T> parameters.

These lines go in the R function body BEFORE the .Call(), keeping the R function signature clean (no quote(expr=) in formals) while still passing the R_MissingArg sentinel through to Rust when the caller omits the argument.

Note: Missing<T> + default is a compile error (checked in miniextendr_fn.rs and miniextendr_impl.rs), so the user_defaults filter is a safety net only.

Returns a vector of R code lines, one per Missing<T> parameter.