net: impl ToSocketAddrs for &[SocketAddr] (#2604)

This commit is contained in:
Taiki Endo 2020-06-11 18:06:15 +09:00 committed by GitHub
parent adaa6849a5
commit 1636910f0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,6 +121,20 @@ impl sealed::ToSocketAddrsPriv for (Ipv6Addr, u16) {
}
}
// ===== impl &[SocketAddr] =====
impl ToSocketAddrs for &[SocketAddr] {}
impl sealed::ToSocketAddrsPriv for &[SocketAddr] {
type Iter = std::vec::IntoIter<SocketAddr>;
type Future = ReadyFuture<Self::Iter>;
fn to_socket_addrs(&self) -> Self::Future {
let iter = self.to_vec().into_iter();
future::ok(iter)
}
}
cfg_dns! {
// ===== impl str =====