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 ability to specify visibility in generated type via #[strum_discriminants] #137

Closed
linclelinkpart5 opened this issue Nov 1, 2020 · 1 comment · Fixed by #138
Closed

Comments

@linclelinkpart5
Copy link
Contributor

linclelinkpart5 commented Nov 1, 2020

By "visibility", I'm referring to pub, pub(crate), etc. I have an enum that I want to keep crate-scoped, but I'd like to generate discriminants and have those discriminants be exported publicly. Perhaps it could be another property in #[strum_discriminants], such as: #[strum_discriminants(vis(pub))]?

@linclelinkpart5
Copy link
Contributor Author

Had some spare time today, and figured I should get my feet wet with using proc macros, so I made a PR (#138)!

Peternator7 pushed a commit that referenced this issue Nov 16, 2020
#138)

* Adding vis to EnumDiscriminants (#137)

* Improved doctest example names (#137)

* Fixing incorrect occurrence_error attr string

* Using r#pub on doctest

* Adding tests for discriminant visibility, and rustc-cfg for bare "pub"

* Doing local import with "self::"

* Back to having tests pass on latest stable

* Moved sample doctest with vis example to separate nocompile block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants