ManevilleF / hexx

Hexagonal tools lib in rust
Apache License 2.0
276 stars 22 forks source link

Derive PartialOrd and Ord on Hex #155

Closed SIGSTACKFAULT closed 4 months ago

SIGSTACKFAULT commented 4 months ago

For when you don't care about how the hexes are ordered, just that you can put them in a BTreeMap.

ManevilleF commented 4 months ago

We cannot have a default Ord/PartialOrd just for that, implementing these traits means that Hex can now be compared to others using >, >=, <, <=. Which does not make sense for coordinates. For example glam does not derive Ord for IVec2.

If implementing these traits in a wrapper is too painful we could either merge #147 or enable this PR under a non default feature flag