pub enum BitPieceStorageMutRef<'a> {
U64(&'a mut u64),
U32(&'a mut u32),
U16(&'a mut u16),
U8(&'a mut u8),
}Expand description
a mutable reference to the storage type of some bitpiece.
when implementing the logic for dealing with a mutable reference to one bitpiece which is embedded inside of another bitpiece, we need to somehow abstract over the storage type of the container bitpiece, so that the contained bitpiece can be embedded into multiple different bitpiece containers with different storage types.
this would usually be performed using generics and traits, but trait functions can’t be called in const contexts, which greatly limits the usability of generics and traits when working in const contexts.
so, instead of using generic, we just use an enum, since we know all possible types in advance anyway.
this allows the code to be generic while also allowing it to work in const contexts.