-
-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
Allow temp
to be combined with assert_eq
.
If both attributes are combined, a build error is generated because the field cannot be found in the scope.
#[deku_derive(DekuRead, DekuWrite)]
pub struct Packet {
#[deku(temp, temp_value = "Self::SIZE", assert_eq = "Self::SIZE")]
size: u16,
// ...
}
impl Packet {
const SIZE: u16 = 128;
}
In this scenario, the packet size is known, hence there is no need for a field in the final struct. However, when reading, I want to ensure that the temporary size matches my known value. When writing, keep the same known value.
elliotsayes
Metadata
Metadata
Assignees
Labels
No labels