We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
repr
It might be cleaner and more reliable to do something like:
enum DiscriminantRepr { C, Primitive(...), } impl DiscriminantRepr { fn try_extract_from_reprs(reprs: &[EnumRepr]) -> Result<DiscriminantRepr, ...> { ... } }
Then we could make derive_is_bit_valid more structural:
derive_is_bit_valid
pub(crate) fn derive_is_bit_valid( reprs: &[EnumRepr], ident: &Ident, generics: &Generics, data: &DataEnum, ) -> TokenStream { let idents = RawIdents::for_enum(ident); match DiscriminantRepr::try_extract_from_reprs(reprs) { Ok(DiscriminantRepr::C) => derive_is_bit_valid_c(data, generics, &idents), Ok(DiscriminantRepr::Primitive(prim)) => derive_is_bit_valid_primitive(data, generics, prim, &idents), Err(...) => ..., } }
Originally posted by @joshlf in #879 (comment)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It might be cleaner and more reliable to do something like:
Then we could make
derive_is_bit_valid
more structural:Originally posted by @joshlf in #879 (comment)
The text was updated successfully, but these errors were encountered: