Skip to content

Commit

Permalink
net: impl ToSocketAddrs for &[SocketAddr] (#2604)
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e authored Jun 11, 2020
1 parent adaa684 commit 1636910
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tokio/src/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =====

Expand Down

0 comments on commit 1636910

Please sign in to comment.