Skip to content

Conversation

@bobozaur
Copy link
Contributor

@bobozaur bobozaur commented Feb 4, 2024

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

@Peternator7 Peternator7 merged commit b6a357d into Peternator7:master Feb 16, 2025
@Peternator7
Copy link
Owner

This is great! Sorry for the long delay, but I've merged this and will hopefully get a new version out today

@bobozaur bobozaur deleted the 258-transparent-attr branch February 16, 2025 20:05
@luxalpa
Copy link

luxalpa commented Apr 13, 2025

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

I would love to see this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add #[strum(transparent)] argument

3 participants