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 suffix attribute #392

Open
nixon-voxell opened this issue Nov 28, 2024 · 2 comments
Open

Add the suffix attribute #392

nixon-voxell opened this issue Nov 28, 2024 · 2 comments

Comments

@nixon-voxell
Copy link

nixon-voxell commented Nov 28, 2024

This is similar to #296 , but instead of prefixing str infront, we add it behind:

use strum_macros::AsRefStr;

#[derive(AsRefStr)]
#[strum(prefix = "path/to/file/", suffix = ".asset")]
enum AssetTypes {
    Filename,
}

fn main() {
    println!("{}", AssetTypes::Filename.as_ref());  // prints "path/to/file/Filename.asset"
}

This could be useful for using enum types for specifying file paths, among many other things.

@nixon-voxell nixon-voxell changed the title Add the prefix attribute Add the suffix attribute Nov 28, 2024
@Peternator7
Copy link
Owner

This makes sense to me. Are you interested in working on this?

@nixon-voxell
Copy link
Author

Yes! I'll give it a go then!

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

No branches or pull requests

2 participants