See similar question:
I want to do much the same thing. So I tried "shortcut", which is a very simple in-memory database. This would do exactly what I want, except that it requires the keys to be ordered; that is, they must have the "Ord" trait. Not because I want to look up with ">", but because "shortcut" uses a tree structure that needs order. Unfortunately, one of my keys is an opaque handle (the ID of something down inside a GPU) that has "Eq" and "Hash", traits, so it can be used in a hash, but not "Ord".
Is there anything like "shortcut" that doesn't need partial ordering over the keys?
Yes, I know I can write this sort of thing with multiple hashes, but if there's a crate, I don't have to. I'll have other objects like this, and a general solution is helpful.