pub(crate) fn default_first<'a>(
choices: &[&'a str],
is_default: impl Fn(&str) -> bool,
) -> Option<Vec<&'a str>>Expand description
The choices of a match_arg parameter’s R formal: choices with the
default moved to the front and the others after it in their order
("Safe" in "Fast", "Safe", "Debug" gives "Safe", "Fast", "Debug"),
or None when is_default holds for no choice.
.miniextendr_match_arg() takes the first element of the formal for
NULL and for the formal itself, so this order is what makes a
default = "..." the default, and the order its message lists. The
wrappers writer builds such a formal with it
(crate::registry::match_arg_formal) and
match_arg_param_with_default matches against it, so the two cannot
disagree (#1767).