ctm / mb2-doc

Mb2, poker software
https://devctm.com
7 stars 2 forks source link

better Rank constants #1106

Closed ctm closed 1 year ago

ctm commented 1 year ago

Put the Rank constants into a module and make them be actual Ranks rather than u8.

When I first started work on mb2, I determined that for efficiency's sake, Ranks should be a newtype u8, but I didn't know Rust very well and made the various named constants (e.g., DEUCE, TREY) be u8 rather than actual Ranks. Furthermore, I put those constants inside the Rank impl. This worked but was pretty awkward and it's been bugging me ever since.

It's never caused enough friction to slow me down, so I couldn't justify spending the time to fix this. However, I wound up doing a little spike just to see how much time it would take to fix and I've already converted the constants to be actual Ranks and moving them to a module shouldn't take much more time. So, I'm creating this issue after all the work (and there really wasn't much) has been done.

ctm commented 1 year ago

Deploying now.