Peternator7 / strum

A small rust library for adding custom derives to enums
https://crates.io/crates/strum
MIT License
1.8k stars 152 forks source link

feat: added discriminator fn #292

Closed DevSlashRichie closed 10 months ago

DevSlashRichie commented 1 year ago

I've just added a discriminant() function which from the original enum returns it matched discriminant. Is just less verbose.

Peternator7 commented 1 year ago

Hey @DevSlashRichie, thanks for opening a PR here. Just to make sure I'm understanding the intention correctly, the purpose of this PR is to add an inherent method because it's shorter than using the Trait impl?

If so, I appreciate the consideration, but I don't think it's a good fit. As convenient as inherent methods are, they are always in scope so it can cause annoying collisions with other userd-defined methods.