Skip to content

Commit 300f91d

Browse files
authored
Generalize HeaderMap's TryFrom impl from HashMap, to allow other hashing functions (#729)
Fixes #726
1 parent 75298bd commit 300f91d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/header/map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,7 @@ impl<T> FromIterator<(HeaderName, T)> for HeaderMap<T> {
20202020
/// let headers: HeaderMap = (&map).try_into().expect("valid headers");
20212021
/// assert_eq!(headers["X-Custom-Header"], "my value");
20222022
/// ```
2023-
impl<'a, K, V, T> TryFrom<&'a HashMap<K, V>> for HeaderMap<T>
2023+
impl<'a, K, V, S, T> TryFrom<&'a HashMap<K, V, S>> for HeaderMap<T>
20242024
where
20252025
K: Eq + Hash,
20262026
HeaderName: TryFrom<&'a K>,
@@ -2030,7 +2030,7 @@ where
20302030
{
20312031
type Error = Error;
20322032

2033-
fn try_from(c: &'a HashMap<K, V>) -> Result<Self, Self::Error> {
2033+
fn try_from(c: &'a HashMap<K, V, S>) -> Result<Self, Self::Error> {
20342034
c.iter()
20352035
.map(|(k, v)| -> crate::Result<(HeaderName, T)> {
20362036
let name = TryFrom::try_from(k).map_err(Into::into)?;

0 commit comments

Comments
 (0)