Skip to content

Conversation

@AlexTMjugador
Copy link

The generic type bounds on PhfSet's get and contains methods for the key are too restrictive, preventing the indexing of a &'static str PhfSet by a &String, for example. The underlying cause is the missing Borrow bound on the indexing type to let client code use any type that can be borrowed to the key type, even if it's not necessarily the same type.

PhfMap already has these more ergonomic bounds, so there is no reason I can see for PhfSet to be different in this regard. So these changes bring more API parity between both collections.

The generic type bounds on `PhfSet`'s `get` and `contains` methods for
the key are too restrictive, preventing the indexing of a `&'static
str` `PhfSet` by a `&String`, for example. The underlying cause is the
missing `Borrow` bound on the indexing type to let client code use any
type that can be borrowed to the key type, even if it's not necessarily
the same type.

`PhfMap` already has these more ergonomic bounds, so there is no reason
I can see for `PhfSet` to be different in this regard. So these changes
bring more API parity between both collections.
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

Successfully merging this pull request may close these issues.

1 participant