From b74b7e627e2fa082920d569fdcd4d0dea252ed05 Mon Sep 17 00:00:00 2001 From: Ivan Boldyrev Date: Tue, 28 Dec 2021 20:19:13 +0700 Subject: [PATCH] refactor(client) use Box in ..::dns::Name Use Box in hyper::client::connect::dns::Name, so its size is 16 bytes, not 24 bytes. As Name never change its contents, read-only Box is perfectly OK. --- src/client/connect/dns.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/connect/dns.rs b/src/client/connect/dns.rs index 968d8567cb..e4465078b3 100644 --- a/src/client/connect/dns.rs +++ b/src/client/connect/dns.rs @@ -38,7 +38,7 @@ pub(super) use self::sealed::Resolve; /// A domain name to resolve into IP addresses. #[derive(Clone, Hash, Eq, PartialEq)] pub struct Name { - host: String, + host: Box, } /// A resolver using blocking `getaddrinfo` calls in a threadpool. @@ -58,7 +58,7 @@ pub struct GaiFuture { } impl Name { - pub(super) fn new(host: String) -> Name { + pub(super) fn new(host: Box) -> Name { Name { host } } @@ -85,7 +85,7 @@ impl FromStr for Name { fn from_str(host: &str) -> Result { // Possibly add validation later - Ok(Name::new(host.to_owned())) + Ok(Name::new(host.into())) } }