#[derive(MatchArg)]
{
// Attributes available to this derive:
#[match_arg]
}
Expand description
Derive MatchArg: enables conversion between Rust enums and R character strings
with match.arg semantics (partial matching, informative errors).
§Usage
ⓘ
#[derive(Copy, Clone, MatchArg)]
enum Mode {
Fast,
Safe,
Debug,
}§Attributes
#[match_arg(rename = "name")]- Rename a variant’s choice string#[match_arg(rename_all = "snake_case")]- Rename all variants (snake_case, kebab-case, lower, upper)#[match_arg(alias = "name")]- Another spelling of a variant’s choice, matched when typed in full; the errors that list the choices name it after them ((or "name" for "choice"))#[match_arg(alias = "name", listed = false)]- The same, named by no error
§Requirements
The enum must be Copy (MatchArg: Copy): derive Copy, Clone with it.
§Generated Implementations
MatchArg- Choice metadata and bidirectional conversionTryFromSexp- Convert R STRSXP/factor to enum (with partial matching)IntoR- Convert enum to R character scalar