mirror of
https://github.com/actix/actix-web.git
synced 2024-11-22 01:21:10 +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:
parent
1114a51b22
commit
eefe8b0733
2 changed files with 11 additions and 3 deletions
|
@ -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 a new issue