strum icon indicating copy to clipboard operation
strum copied to clipboard

Add `#[strum(transparent)]` attribute

Open bobozaur opened this issue 2 years ago • 0 comments

Adds the transparent attribute, usable with AsRefStr, Display and IntoStaticStr. This delegates the derived trait impl to the underlying (single) field of the enum variant.

Implementing this for EnumString would be nice, but it doesn't really act the same way as for the other traits. For EnumString, something like #[strum(other)] (similar to #[serde(other)]) would make more sense, because there you would have a last single attempt to parse the input into a catch all variant, whereas trasparent can be added to multiple variants.

Therefore, if desired, that should be handled in a separate PR.

Closes #258

bobozaur avatar Feb 04 '24 14:02 bobozaur