Robbepop / modular-bitfield

Macro to generate bitfields for structs that allow for modular use of enums.
Apache License 2.0
155 stars 40 forks source link

Support for byte arrays #92

Open chemicstry opened 1 year ago

chemicstry commented 1 year ago

Firstly, thanks for such a great crate! I wish I had found it sooner...

I tried searching through issues and couldn't find anything about byte arrays. Here is what I would like to use:

#[bitfield]
struct Packet {
    opcode: B6,
    status: B2,
    data: [u8; 8], // Error: `the trait bound `[u8; 8]: modular_bitfield::Specifier` is not satisfied`
    other_field: B8,
}

Is there anything fundamental to why this is not supported? If not, I could try contributing a PR for such feature.