pub fn match_arg_missing_or<U, E>(
sexp: SEXP,
inner: impl FnOnce(SEXP) -> Result<U, E>,
) -> Result<Missing<U>, E>Expand description
The Missing<_> layer of a choice parameter (#1551): the missing-argument
sentinel is Missing::Absent, anything else
(NULL included) is decoded by inner and becomes Missing::Present.
The generated R wrapper keeps the choice vector as the formal default,
skips the match.arg() check for an omitted argument and forwards R’s
missing-argument sentinel (if (missing(x)) quote(expr=) else x), so
#[miniextendr(match_arg)] mode: Missing<Option<Mode>> reaches Rust as
Absent when omitted, Present(None) for NULL, and
Present(Some(mode)) for a matched choice. A single-choice parameter
treats its formal passed whole the same way (#2152): before the check the
wrapper binds .mx_absent_x <- missing(x) || identical(x, c(...)), skips
the check for it and forwards the sentinel
(if (.mx_absent_x) quote(expr=) else x), so that value is Absent too,
while a value the check matches is Present even when the choice vector
has one element (#2182); a several_ok list reads that vector as every
choice. The C wrapper decodes it with
match_arg_missing_or(sexp, match_arg_option_from_sexp::<Mode>).