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

HeaderMap's TryFrom<HashMap> is not generic over the hashing algorithm used #726

Closed
Qqwy opened this issue Nov 23, 2024 · 2 comments · Fixed by #729
Closed

HeaderMap's TryFrom<HashMap> is not generic over the hashing algorithm used #726

Qqwy opened this issue Nov 23, 2024 · 2 comments · Fixed by #729

Comments

@Qqwy
Copy link
Contributor

Qqwy commented Nov 23, 2024

HeaderMap<T> implements TryFrom<&'a HashMap<K, T>>. However, this only covers hashmaps created with the default S = RandomState hashing algorithm / state.
If you've gathered some headers from elsewhere (in my case: in a Python library with PyO3) and you want to turn those into a HeaderMap for use in a HTTP client, there is no need to use a HashDoS-resistant hashing function, so being able to use a hashmap with a different hashing function would be great.

As far as I can tell, there is no reason why the current implementation could not work for other hashmaps. The only thing that needs to change is exposing S parameter as well in the trait implementation bounds.

@seanmonstar
Copy link
Member

That makes sense, want to submit a PR?

@Qqwy
Copy link
Contributor Author

Qqwy commented Nov 26, 2024

Yes, will do!

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 a pull request may close this issue.

2 participants