for the hashbrown api, which uses the Equivalent trait to mark the lookup key types, this is easy to do, but the standard library hashmap api uses the Borrow trait, and you need an extra level of indirection to make it work.
the trick is to make both the stored key and the lookup key to borrow and delegate their Hash to some common type, and this common type can be a dyn Trait. read this article for details:
My use case is essentially building reverse lookup tables based on combinations of different properties (many of which are String) of a bunch of different item types so having to make a new type for each key is definitely tedious. Thankfully macros will make it easier to manage and encapsulating the conversions using traits will make the public API seamless. I will go with this approach, thank you very much.
That was an interesting read and although it could work I think the solution above is simpler for my case. Anyway I have been wanting to write more flexible public APIs using standard traits so this might come in handy in the future. Thank you, bookmarked