Closed marxin closed 2 months ago
This is not a bug in binrw. modular_bitfield, which is processing the struct first, transforms the struct to using an array of bytes internally. Once it's an array of bytes, any endianess information is opaque to binrw, and cannot be acted upon.
Your available options:
Thanks for the clarification. Yes, I understand it's related more to modular_bitfield
. Anyway, my solution is that I encapsulated the bitfields into structs that don't contain any basic integral types (u16
, ...).
Would you appreciate if I made a PR where I would document the current behavior when it comes to multi-byte integral types within #[bitfield]
struct?
I noticed that while parsing a DNS message header:
It seems the endianess of the natural multi-byte integral types is ignored:
Fails with:
Apparently
modular_bitfield
does not have any handling of endianness and that's why I face the issue. Can you please do something about it? Thanks for help!