[project] Distinguish structs/union/enums by joshlf · Pull Request #2857 · google/zerocopy
joshlf
changed the title
[project] Use -1 for struct/union
[project] Distinguish structs/union/enumsVARIANT_ID
For the `HasField` `VARIANT_ID` and `FIELD_ID` constants, use `i128` instead of `u128`. For structs and unions, set `VARIANT_ID = -1` and `VARIANT_ID = -2` (respectively) instead of 0. This ensures that we will never accidentally confuse the first (ie, 0th) variant of an enum with a struct or union. It also paves the way for us to define methods which only support a subset of structs/unions/enums. Makes progress on #196, #2856 gherrit-pr-id: G03596047b3e8a9931799295d1e707540561c4e46
joshlf
deleted the
G03596047b3e8a9931799295d1e707540561c4e46
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters