1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-26 03:21:08 +00:00

Implement From<HeaderMap> for http::HeaderMap (#3222)

* Implement From<HeaderMap> for http::HeaderMap

* Update changelog

* Apply clippy fix

* doc tweak

---------

Co-authored-by: SleeplessOne1917 <insomnia-void@protonmail.com>
Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
SleeplessOne1917 2023-12-16 10:08:45 +00:00 committed by GitHub
parent 1114a51b22
commit eefe8b0733
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View file

@ -5,6 +5,7 @@
### Changed ### Changed
- Updated `zstd` dependency to `0.13`. - Updated `zstd` dependency to `0.13`.
- Implemented `From<HeaderMap>` for `http::HeaderMap`.
### Fixed ### Fixed

View file

@ -636,10 +636,17 @@ impl<'a> IntoIterator for &'a HeaderMap {
} }
} }
/// Convert `http::HeaderMap` to our `HeaderMap`. /// Convert a `http::HeaderMap` to our `HeaderMap`.
impl From<http::HeaderMap> for HeaderMap { impl From<http::HeaderMap> for HeaderMap {
fn from(mut map: http::HeaderMap) -> HeaderMap { fn from(mut map: http::HeaderMap) -> Self {
HeaderMap::from_drain(map.drain()) Self::from_drain(map.drain())
}
}
/// Convert our `HeaderMap` to a `http::HeaderMap`.
impl From<HeaderMap> for http::HeaderMap {
fn from(map: HeaderMap) -> Self {
Self::from_iter(map)
} }
} }