You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes, IndexMap is passed as a parameter. But many cache implementations are essentially a large hashmap. So if I want to cache the return value of a function which contains a parameter of type IndexMap, IndexMap must implements Hash. But currently is not.
The problem is inconsistency between Eq and Hash -- see #288. However, we have since published the ordermap crate, which is a thin wrapper around indexmap that does use map order for both Eq and Hash, and Ord as well.
Your own wrapper can work too, but you should re-implement PartialEq using iterator order, rather than deriving it.
Sometimes,
IndexMap
is passed as a parameter. But many cache implementations are essentially a large hashmap. So if I want to cache the return value of a function which contains a parameter of typeIndexMap
,IndexMap
must implementsHash
. But currently is not.I wrote a simple wrapper and it works fine:
The text was updated successfully, but these errors were encountered: