FixedBitSet is actually RunTimeSizedBitSet, because it predates const generic parameters and has a Vec inside. Is there a replacement yet which just gives you some fixed number of bits at compile time and compiles down to the machine bit instructions?
FixedBitSet has "Debug", but it's not too useful. It gives you, in decimal, the values in the internal Vec. So here I write one that gives you which bits are set, as [1, 3, 5]. Can that be rewritten in functional style?
Something like this? Unfortunately arithmetic expressions in const generics are not stable yet so the ideal struct BitSet<const BITS: usize>([u8; (BITS + 7) / 8]) won't work. Also, of course, for sizes up to 64 bits you can do better by just wrapping a u64.
Right. I've hit that one. I do a lot of decoding of strange binary formats, and often need that sort of thing. Looking forward to that making it to stable and libraries following along.