pub trait ToSocketAddrs {
type Iter: Iterator<Item = SocketAddr> + Send + 'static;
type Future: Future<Output = Result<Self::Iter, Error>> + Send + 'static;
// Required method
fn to_socket_addrs(&self) -> Self::Future;
}
Expand description
Converts or resolves without blocking to one or more SocketAddr
values.
§DNS
Implemented custom DNS resolution for string type ToSocketAddrs
,
user can change default dns resolution server via set_custom_dns_server
.
Required Associated Types§
Sourcetype Iter: Iterator<Item = SocketAddr> + Send + 'static
type Iter: Iterator<Item = SocketAddr> + Send + 'static
An iterator over SocketAddr
Required Methods§
Sourcefn to_socket_addrs(&self) -> Self::Future
fn to_socket_addrs(&self) -> Self::Future
Returns an asynchronous iterator for getting SocketAddr
Implementations on Foreign Types§
Source§impl ToSocketAddrs for &[SocketAddr]
impl ToSocketAddrs for &[SocketAddr]
type Future = Ready<Result<<&[SocketAddr] as ToSocketAddrs>::Iter, Error>>
type Iter = IntoIter<SocketAddr>
fn to_socket_addrs(&self) -> Self::Future
Source§impl ToSocketAddrs for (&str, u16)
impl ToSocketAddrs for (&str, u16)
Source§impl ToSocketAddrs for (IpAddr, u16)
impl ToSocketAddrs for (IpAddr, u16)
Source§impl ToSocketAddrs for (String, u16)
impl ToSocketAddrs for (String, u16)
Source§impl ToSocketAddrs for (Ipv4Addr, u16)
impl ToSocketAddrs for (Ipv4Addr, u16)
Source§impl ToSocketAddrs for (Ipv6Addr, u16)
impl ToSocketAddrs for (Ipv6Addr, u16)
Source§impl ToSocketAddrs for SocketAddr
impl ToSocketAddrs for SocketAddr
type Future = Ready<Result<<SocketAddr as ToSocketAddrs>::Iter, Error>>
type Iter = IntoIter<SocketAddr>
fn to_socket_addrs(&self) -> Self::Future
Source§impl ToSocketAddrs for str
impl ToSocketAddrs for str
Source§impl ToSocketAddrs for String
impl ToSocketAddrs for String
Source§impl ToSocketAddrs for SocketAddrV4
impl ToSocketAddrs for SocketAddrV4
type Future = Ready<Result<<SocketAddrV4 as ToSocketAddrs>::Iter, Error>>
type Iter = IntoIter<SocketAddr>
fn to_socket_addrs(&self) -> Self::Future
Source§impl ToSocketAddrs for SocketAddrV6
impl ToSocketAddrs for SocketAddrV6
type Future = Ready<Result<<SocketAddrV6 as ToSocketAddrs>::Iter, Error>>
type Iter = IntoIter<SocketAddr>
fn to_socket_addrs(&self) -> Self::Future
Source§impl<T> ToSocketAddrs for &Twhere
T: ToSocketAddrs + ?Sized,
Implement this trait for &T of type !Sized(such as str), since &T of type Sized all implement it
by default.
impl<T> ToSocketAddrs for &Twhere
T: ToSocketAddrs + ?Sized,
Implement this trait for &T of type !Sized(such as str), since &T of type Sized all implement it by default.