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

Disjoint Fields #73

Closed cujomalainey closed 2 years ago

cujomalainey commented 2 years ago

Hello and thank you for your excellent crate, I have been reading through it for a while before I start a project and I wanted to get your opinion about how to best tackle an issue in my project.

I am planning on writing some crates to support Garmin's ANT spec and most of their data is LE and contiguous fields... except one legacy profile which has the following layout.

Bit 0-7 8-11 12-15 16-23
Field LSB Field A LSN Field B MSN Field A MSB Field B

Does your library have any mechanism to resolve this legacy issue or do you know if there are any tricks I can employ to get around this?

P.S. I am new to rust, and am planning to use this project to get better with the language. Also I am avoiding building anything too big as the plan is to support embedded targets.

cujomalainey commented 2 years ago

I think my best bet is to use private fields and just write the getters and setters manually.