Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the prefix attribute #296

Merged
merged 4 commits into from Dec 28, 2023
Merged

Conversation

chanman3388
Copy link
Contributor

@chanman3388 chanman3388 commented Sep 15, 2023

The idea here was to allow the addition of the prefix attribute such that when displaying the enum variant that said variant will have the prefix. This should be exempt from other formatting. Example usage:

use strum::{Display, EnumString};

#[derive(Debug, EnumString, Display)]
#[strum(prefix = "prefix")]
enum Thing {
    Test,
}

fn main() {
    println!("{}", Thing::Test);  // prints "prefixTest"
}

Could possibly add some kind of skipping mechanism for individual variants.

@Peternator7 Peternator7 merged commit 216e4de into Peternator7:master Dec 28, 2023
1 check passed
@Peternator7
Copy link
Owner

Looks great! Merged

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.

None yet

2 participants