From 2764e54c29d0f19242e794d5eecd00cc5470f530 Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Fri, 5 Jun 2020 01:49:50 +0200 Subject: [PATCH] impl ToSocketAddrs for (String, u16) --- src/libstd/net/addr.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index b780340884e..25897c502ec 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -1000,6 +1000,14 @@ fn to_socket_addrs(&self) -> io::Result> { } } +#[stable(feature = "string_u16_to_socket_addrs", since = "1.46.0")] +impl ToSocketAddrs for (String, u16) { + type Iter = vec::IntoIter; + fn to_socket_addrs(&self) -> io::Result> { + (&*self.0, self.1).to_socket_addrs() + } +} + // accepts strings like 'localhost:12345' #[stable(feature = "rust1", since = "1.0.0")] impl ToSocketAddrs for str {