Somewhat new to rust, but trying to figure out the best way to encode enums that come from a external specification (and have defined byte values). Particularly I'm trying to represent MIDI notes/commands.
My first pass is here https://github.com/btrepp/usbd-midi/blob/master/src/notes.rs. Though I dislike how many items are in the enum, and also that defining flats seems a little awkward.
Though I'm wondering if I would be better off defining const u8s, and then maybe making a higher level type?, and writing functions to parse/format that into u8s?.
Particularly curious in how best to extend it to data in the midi spec that uses the first 4bits for one purpose, and the second 4 for something else.