From 1a166f24b3fe42689d543c8c86c227da162c5ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=97=E6=B5=A6=E6=9C=88?= Date: Thu, 30 Jul 2020 21:52:53 +0800 Subject: [PATCH] impl `ToSocketAddrs` for `(String, u16)` --- tokio/src/net/addr.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tokio/src/net/addr.rs b/tokio/src/net/addr.rs index 5ba898a15a7..ed00ca4a7c6 100644 --- a/tokio/src/net/addr.rs +++ b/tokio/src/net/addr.rs @@ -201,6 +201,19 @@ cfg_dns! { } } + // ===== impl (String, u16) ===== + + impl ToSocketAddrs for (String, u16) {} + + impl sealed::ToSocketAddrsPriv for (String, u16) { + type Iter = sealed::OneOrMore; + type Future = sealed::MaybeReady; + + fn to_socket_addrs(&self) -> Self::Future { + (self.0.as_str(), self.1).to_socket_addrs() + } + } + // ===== impl String ===== impl ToSocketAddrs for String {}