-
Notifications
You must be signed in to change notification settings - Fork 151
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
Equivalence trait instead of Borrow #183
Comments
Looked into this. It seems to be currently blocked by rust-lang/rust#56167 as we use the std hashmap under the hood. |
Now unblocked as we've switched to hashbrown. |
@xacrimon This one's pretty straightforward. PR and merge? |
Common |
That's true, but we care about whatever |
Users of indexmap may prefer to implement |
That's true, however, they are free to do that. Even if we reexport the trait as Just to be clear, is your preferred solution different from this? |
@tomkarw well, this crate exports hashbrown |
See how
IndexMap
is doing it: https://docs.rs/indexmap/latest/indexmap/map/struct.IndexMap.html#method.getEquivalent
trait is implemented automatically forBorrow
, but additionally it can be implemented for complex types. Consider this example:With
indexmap
it is possible to implementKeyRef: Equivalent<Key>
and query byKeyRef
.It is not possible to implement reasonable
Borrow
forKey
(without allocating).The text was updated successfully, but these errors were encountered: