Skip to content

Commit

Permalink
Generalize HeaderMap's TryFrom impl from HashMap, to allow other hash…
Browse files Browse the repository at this point in the history
…ing functions

Fixes #726
  • Loading branch information
Qqwy committed Nov 26, 2024
1 parent 75298bd commit 25d2dc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/header/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@ impl<T> FromIterator<(HeaderName, T)> for HeaderMap<T> {
/// let headers: HeaderMap = (&map).try_into().expect("valid headers");
/// assert_eq!(headers["X-Custom-Header"], "my value");
/// ```
impl<'a, K, V, T> TryFrom<&'a HashMap<K, V>> for HeaderMap<T>
impl<'a, K, V, S, T> TryFrom<&'a HashMap<K, V, S>> for HeaderMap<T>
where
K: Eq + Hash,
HeaderName: TryFrom<&'a K>,
Expand All @@ -2030,7 +2030,7 @@ where
{
type Error = Error;

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

0 comments on commit 25d2dc1

Please sign in to comment.