I would like to port some C code to Rust that does something similar to nullable pointers but with positive integers. Missing data in some large data structures is represented with negative integer values in a signed integer. 31 bits are available for the main value, and what is essentially an empty enum variant is packed into the sign bit.
Rust has the nullable pointer optimization to do something very similar with pointers.
I could do a 1 to 1 port and keep using raw signed integers for this, but is there a better way that doesn't incur a performance penalty? Some sort of advanced enum repr hint?