Skip to main content

match_arg_aliases_arg

Function match_arg_aliases_arg 

Source
#[doc(hidden)]
pub fn match_arg_aliases_arg( choices: &[&str], aliases: &[MatchArgAlias], placeholder: &str, ) -> String
Expand description

The trailing arguments a match_arg parameter’s check passes to .miniextendr_match_arg / .miniextendr_match_arg_several for the type’s MatchArg::ALIASES (#1843), which the wrappers writer splices in place of , <placeholder>: , aliases = base::c("grey" = "gray"), each alias and choice escaped for an R string literal. For a type without aliases it is empty, so that wrapper keeps the text it had before aliases existed. base::c is spelled out because the argument is written after the shadowing pass, which would otherwise qualify it for a parameter named c.

When an alias is listed, , listed = " (or \"grey\" for \"gray\")" follows: the clause the check’s message appends after the choices, rendered here by the same function as the Rust side’s messages (match_arg::listed_aliases_clause), so the two word it alike (#2148). A type whose aliases are all unlisted passes no listed, and its check words its message as without aliases.

Aliases a hand-written impl got wrong (empty, "NA", a choice, repeated, a prefix of another choice, or naming no choice; the rules #[derive(MatchArg)] enforces at compile time) panic with the placeholder, as match_arg_formal does for a bad default.