Forbidden/niche values

Maybe instead of trying to explain to the compiler where's the niche, there could be a run-time hook for packing/unpacking values from a custom enum representation?

I have no idea how it could look like syntax-wise, but the general idea is that you could implement some trait with "set enum to this value" and "get me current value of this enum" methods, and these could perform arbitrary work (maybe const) to pack the data however they want.