"I'm looking for ideas/suggestion..." <- > <@762spr:matrix.org> I'm looking for ideas/suggestions on a good way to track registers and sub registers for a driver crate. I would like to be able to use named values and restrict sub register values to their parent register. > > Example: this works great for single level registers > ``` > #[non_exhaustive] > struct Regs; > > impl Regs { > pub const REG1: u8 = 0x00; > pub const REG2: u8 = 0x21; > pub const REG3: u8 = 0x36; > } > ``` > > Is there a preferred / idiomatic structure for something like this? Are you wanting to build a tool like this, or is it something you're missing? If you're just looking to use a tool for this, might I suggest looking at https://crates.io/crates/device-driver ??