I'm using a library which provides an enum, whose variants I would like to use as keys in a hash and/or btree map. The library's enum doesn't implement Hash or Ord.
enum
Hash
Ord
Can I do better than go through the whole newtype pattern song-and-dance by hand?
No. You can't even use a macro to automate it because macros cannot look into types not defined inside the macro invocation.
Ask the library maintainer to add these derives.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.