Skip to main content

Module match_arg_derive

Module match_arg_derive 

Source
Expand description

§#[derive(MatchArg)] - Enum ↔ R String with match.arg Support

This module implements the #[derive(MatchArg)] macro which generates the MatchArg trait implementation for C-style enums, enabling automatic conversion between Rust enums and R character strings with partial matching.

§Usage

#[derive(Copy, Clone, MatchArg)]
enum Mode {
    Fast,
    Safe,
    Debug,
}

// Generates impl MatchArg for Mode, TryFromSexp for Mode, IntoR for Mode.

§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)

Structs§

MatchArgAttrs 🔒
Parsed #[match_arg(...)] attributes from an enum or variant.

Functions§

derive_match_arg
Main entry point for #[derive(MatchArg)].
parse_match_arg_attrs 🔒
Parse #[match_arg(...)] attributes from a list of syn::Attribute.