-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Unpack from slice #250
Comments
Hm, yes that should still work because |
Thinking about this a bit more, I'm hesitant to call this a bug. Perhaps it would be useful to have another derive attribute instead. Something like e.g. struct Example {
/// Decode the lower 2 bytes of the field, padding the rest with zeros
#[wire(bits = 16, pad = 16)]
field: u32
/// Equivalent in bytes
#[wire(bytes = 2, pad_bytes = 2)]
equivalent: u32
} I'm still wondering why you need to decode a |
I just stumbled upon this when I was trying to unpack a fixed size array of u8, but simplified the example here. So I made a workaround using bitview in process loop. I agree this is a feature. pad and pad_bytes sounds nice, that is if it can work inside an array |
I changed type of bar to u32 and get
ReadBufferTooShort
I am guessing this should work?
The text was updated successfully, but these errors were encountered: