Skip to content

Better document/test ordering constraints #29

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

Open
kupiakos opened this issue Feb 3, 2025 · 0 comments
Open

Better document/test ordering constraints #29

kupiakos opened this issue Feb 3, 2025 · 0 comments

Comments

@kupiakos
Copy link
Owner

kupiakos commented Feb 3, 2025

This runs the derive on the enum definition and not the generated struct:

#[derive(IntoBytes, FromBytes, Immutable)]
#[open_enum]
#[repr(u32)]
pub enum TestEnum {
    FirstValue = 0xaabbccdd_u32.to_be(),
}

Switching the open_enum attribute to the top causes it to process the struct as expected. The zerocopy maintainers are already aware of the general issue. Fortunately this can never cause soundness problems as open-enum always generates types less strict than their equivalent enums.

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

1 participant