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
Visibility for EnumIter #237
Comments
I think this triggers a warning/error if you do this? Are you suggesting something like this (playground link)? Unlike EnumDiscriminants, |
Okay yeah, I do get an error when I'm missing the same visibility as the enum type. I tried to experiment with having I guess we can technically force privacy and get rid of the error by redeclaring an entirely new trait within the module (playground link), but this starts becoming an unfortunate workaround |
It unfortunately does get increasingly awkward to work around. While I think more flexibility is nice, I don't think rust really has the features we need to implement this properly at the moment (not to mention the back-compact difficulties) so I'm going to suggest we hold off making any changes, but I do appreciate the discussion. |
It seems currently the struct generated from
#[derive(EnumIter)]
propagates the visibility from the original enum. Is it possible to have this configurable?This was mentioned in an early comment and it seems like we have precedent for this in other macros.
A work around I've been using is wrapping my enum in an
mod inner { ... }
and re-exporting what I want to be public withpub use inner::MyEnum
The text was updated successfully, but these errors were encountered: