We'd need to know the details of how the data is encoded. Does it pack multiple bools into a single byte, and if so does it start from the most-significant or least-significant bit? And are any padding bits inserted if the next value is not a BOOL? (If not, then following values might not be byte-aligned, which means you can't read them using byteorder.)
Your data_for_decoding is eight bytes long, and you are trying to read eight BOOL values followed by one U8 value. I would expect the data to be either two bytes long (if each BOOL takes up one bit) or nine bytes long (if each BOOL takes up one byte), not eight.
We'd need to know the details of how the data is encoded. Does it pack multiple bools into a single byte, and if so does it start from the most-significant or least-significant bit?
Ultimately, it should be configurable. Suppose Lsb0.
And are any padding bits inserted if the next value is not a BOOL ? (If not, then following values might not be byte-aligned, which means you can't read them using byteorder .)
In this case, you'll need more state than just a Cursor<Vec<u8>>, since you will also need to keep track sometimes of your current bit offset within the current byte.
If you know which bit to read next, you can use bit shifting and masking to retrieve it and convert it to bool, e.g.: