Skip to content

Commit

Permalink
Implement From<&HeaderMap> for http::HeaderMap (#3230)
Browse files Browse the repository at this point in the history
* Add From impl for header map references

* Add From impl for header map references

* Remove Into<HeaderMap> via http::HeaderMap

* fix changelog

---------

Co-authored-by: SleeplessOne1917 <[email protected]>
Co-authored-by: Rob Ede <[email protected]>
  • Loading branch information
3 people committed Feb 1, 2024
1 parent c1f88f7 commit ae7736f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions actix-http/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Added

- Implement `From<&HeaderMap>` for `http::HeaderMap`.

## 3.5.1

### Fixed
Expand Down
7 changes: 7 additions & 0 deletions actix-http/src/header/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,13 @@ impl From<HeaderMap> for http::HeaderMap {
}
}

/// Convert our `&HeaderMap` to a `http::HeaderMap`.
impl From<&HeaderMap> for http::HeaderMap {
fn from(map: &HeaderMap) -> Self {
map.to_owned().into()
}
}

/// Iterator over removed, owned values with the same associated name.
///
/// Returned from methods that remove or replace items. See [`HeaderMap::insert`]
Expand Down

0 comments on commit ae7736f

Please sign in to comment.