Using sets as keys to a HashMap

How can I use some sort of set(unorder collection of strings) as the keys for a HashMap?

I'm trying to port PBC/HowCanYouPayMana.v3.py at master · DrAlta/PBC · GitHub

BTreeSet implements Hash and can be used as the key in a HashMap.

3 Likes

Kind of ironic that HashSet doesn't have an impl for Hash.

Since the HashSet doesn't have defined ordering of its element, it cannot generates consistent hash over different HashSets with same elements.

2 Likes

It was once attempted:
https://github.com/rust-lang/rust/pull/48366

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.