-
The following was working in version 0.11.2: use binrw::binrw;
#[binrw]
#[bw(assert(self.0 > 0))]
pub struct u24(pub u32); But fails in version 0.12.0 with:
How can I refer to the elements of a tuple struct in an assert directive (if at all)? Thank you. |
Beta Was this translation helpful? Give feedback.
Answered by
csnover
Oct 26, 2023
Replies: 1 comment 1 reply
-
You can access tuple fields by the variable |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
faro-dr
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can access tuple fields by the variable
self_N
, whereN
is the number of the field. However, it should be possible to also useself
at the top level, so I have opened #232 to track this.