mirror of https://github.com/fafhrd91/actix-web
Add From impl for header map references
This commit is contained in:
parent
f4851b3914
commit
f3e7ac2332
|
@ -2,6 +2,10 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
### Changed
|
||||
|
||||
- Implement `From<&HeaderMap>` for `http::HeaderMap` and vice versa.
|
||||
|
||||
## 3.5.0
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -643,6 +643,15 @@ impl From<http::HeaderMap> for HeaderMap {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> From<&T> for HeaderMap
|
||||
where
|
||||
T: Into<http::HeaderMap>,
|
||||
{
|
||||
fn from(map: &T) -> Self {
|
||||
map.to_owned().into()
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert our `HeaderMap` to a `http::HeaderMap`.
|
||||
impl From<HeaderMap> for http::HeaderMap {
|
||||
fn from(map: HeaderMap) -> Self {
|
||||
|
@ -650,6 +659,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`]
|
||||
|
|
Loading…
Reference in New Issue