Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement HttpTryFrom<HashMap<String,String>> for HeaderMap
This allows an easy conversion from HashMap<String,String> to HeaderMap<HeaderValue>. Doing this conversion used to be unnecessarily verbose because of the required mapping and error type conversions. The implementation is generic: impl<COLLECTION, K, V> HttpTryFrom<COLLECTION> for HeaderMap<HeaderValue> where COLLECTION: IntoIterator<Item=(K, V)>, K: AsRef<str>, V: AsRef<str> so it also works for HashMap<HeaderName, String> and for vectors. Fixes #325
- Loading branch information
Showing
1 changed file
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters