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

Assert for tuple enum #412

Open
libklein opened this issue Jan 21, 2024 · 1 comment
Open

Assert for tuple enum #412

libklein opened this issue Jan 21, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@libklein
Copy link

libklein commented Jan 21, 2024

I am wondering whether it is possible to define assertions over (anonymous) tuple structs, as in the following example:

#[derive(DekuRead, DekuWrite)]
#[deku(type = "u8", bits = "1")]
pub enum RegisterOrValue {
    #[deku(id = "0b0")]
    Field(#[deku(assert = "*??? < 32")] u8),
}

Is there some deku internal name that could be used to reference the parsed u8?

@wcampbell0x2a wcampbell0x2a added the enhancement New feature or request label Jan 30, 2024
@sharksforarms
Copy link
Owner

Try the following: #[deku(assert = "*field_0 < 32")] u8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants