Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Hash trait #155

Closed
1Dragoon opened this issue Sep 16, 2020 · 2 comments
Closed

.Hash trait #155

1Dragoon opened this issue Sep 16, 2020 · 2 comments

Comments

@1Dragoon
Copy link

1Dragoon commented Sep 16, 2020

I'm kind of a noob to Rust, but I commonly use structures similar to this to build "dynamic" types of sorts for when schemas aren't known until runtime (and insertion order must be retained), and then do operations on these objects with HashSets (union, difference, intersect, etc.) That said, I think it would be useful in situations like mine if IndexMap implemented the .Hash trait, similar to how btreemap does.

@cuviper
Copy link
Member

cuviper commented Sep 16, 2020

We currently implement equality independent of order, and Hash has to be consistent when two things are equal, but we don't have an order-independent way to hash. See also #75 and #67.

@cuviper
Copy link
Member

cuviper commented Sep 18, 2020

I'll also note that changing equality comparison is on the list of possible changes for 2.0 (#135), and if we do that it will be feasible to implement Hash as well. Until then, I think we just can't do it, so I'm closing this.

Feel free to reply if you have any more questions about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants