fn derive_simple_factor(
name: &Ident,
impl_generics: &ImplGenerics<'_>,
ty_generics: &TypeGenerics<'_>,
where_clause: Option<&WhereClause>,
variants: &Punctuated<Variant, Comma>,
rename_all: Option<&str>,
) -> Result<TokenStream>Expand description
Generate RFactor, MatchArg, IntoR, and TryFromSexp impls for simple
(unit variant) enums.
Each variant maps to a 1-based level index and a level name string.
Level names are determined by variant ident, optionally transformed by
rename_all or overridden by per-variant #[r_factor(rename = "...")].
Uses a OnceLock-cached levels SEXP for efficient repeated conversion.
Returns Err if any variant has fields (only C-style enums are supported
in the simple path).