mirror of
https://github.com/fafhrd91/actix-web
synced 2024-12-03 20:02:12 +01: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:
parent
1114a51b22
commit
eefe8b0733
@ -5,6 +5,7 @@
|
||||
### Changed
|
||||
|
||||
- Updated `zstd` dependency to `0.13`.
|
||||
- Implemented `From<HeaderMap>` for `http::HeaderMap`.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
@ -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 {
|
||||
fn from(mut map: http::HeaderMap) -> HeaderMap {
|
||||
HeaderMap::from_drain(map.drain())
|
||||
fn from(mut map: http::HeaderMap) -> Self {
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user