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

Support (@witx repr u16) format for enums #323

Closed
fschutt opened this issue Sep 23, 2022 · 1 comment
Closed

Support (@witx repr u16) format for enums #323

fschutt opened this issue Sep 23, 2022 · 1 comment

Comments

@fschutt
Copy link

fschutt commented Sep 23, 2022

Currently the code generator can only generate u8 bitflags for enums. This is a problem because when migrating from .witx to .wit, we cannot port any enum flags. Is repr u16, repr u32, etc. going to be supported or how should this be ported?

@alexcrichton
Copy link
Member

It's not intended that support will be added for this at this time. The representation of enums is defined with the canonical abi in the component-model repository and isn't something that wit-bindgen is at the liberty of modifying.

The representation of an enum is also not always u8. If there are more than 256 variants then u16 is chosen to fit the variant. More details can be found in that repository.

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