From 68d89a7d84395893985b8592972c73791c1f4811 Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 Date: Fri, 15 Dec 2023 20:26:00 -0500 Subject: [PATCH] Implement From for http::HeaderMap --- actix-http/src/header/map.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/actix-http/src/header/map.rs b/actix-http/src/header/map.rs index e8118be93..3a500a70c 100644 --- a/actix-http/src/header/map.rs +++ b/actix-http/src/header/map.rs @@ -638,8 +638,15 @@ impl<'a> IntoIterator for &'a HeaderMap { /// Convert `http::HeaderMap` to our `HeaderMap`. impl From 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 'http::HeaderMap'. +impl From for http::HeaderMap { + fn from(map: HeaderMap) -> Self { + Self::from_iter(map.into_iter()) } }