I was planning on using a tuple struct like struct Wrap(pub u8)
to represent a number (which never exceeds 63) when it occurred to me that there may be no benefit to using u8
over usize
instead, and using usize
saves me from casting when I need to use the number to index into a slice. u8
"saves" me 3 bytes, but I'm not certain of that with data alignment on 64-bit processors.
Apart from "use the most appropriate data type", to which I think u8
and usize
are equally applicable in my situation, what are the benefits to using u8
over usize
and vice versa?