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
Generic key type prevents finding with non-static slices #8
Comments
|
But I agree it is an issue. |
I had assumed that |
|
(I was unaware of the unwritten assumption that |
It is a bit dubious, but it's consistent with the way it's used in HashMap. I think @aturon is working on/thinking about a better solution. |
PhfMap<&'static str, Keyword>
hasK
set to&'static str
. This is an absolute killer for rust-phf, negating (without unsafe code) the whole point of the library.In other words, this is
See the problem? I must pass the key as a reference to a static string.
If I wanted to do it based on user input—by far the most common case, I expect—I cannot do that, for it is not
&'static str
.As it stands, I must cheat by transmuting the lifetime for the duration of the call, knowing it to be safe.
We evidently need something else. Straight generics don’t cut it.
The text was updated successfully, but these errors were encountered: