Trait ToSocketAddrs

Source
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§

Source

type Iter: Iterator<Item = SocketAddr> + Send + 'static

An iterator over SocketAddr

Source

type Future: Future<Output = Result<Self::Iter, Error>> + Send + 'static

Future representing an iterator

Required Methods§

Source

fn to_socket_addrs(&self) -> Self::Future

Returns an asynchronous iterator for getting SocketAddr

Implementations on Foreign Types§

Source§

impl ToSocketAddrs for &[SocketAddr]

Source§

impl ToSocketAddrs for (&str, u16)

Source§

impl ToSocketAddrs for (IpAddr, u16)

Source§

impl ToSocketAddrs for (String, u16)

Source§

impl ToSocketAddrs for (Ipv4Addr, u16)

Source§

impl ToSocketAddrs for (Ipv6Addr, u16)

Source§

impl ToSocketAddrs for SocketAddr

Source§

impl ToSocketAddrs for str

Source§

impl ToSocketAddrs for String

Source§

impl ToSocketAddrs for SocketAddrV4

Source§

impl ToSocketAddrs for SocketAddrV6

Source§

impl<T> ToSocketAddrs for &T
where T: ToSocketAddrs + ?Sized,

Implement this trait for &T of type !Sized(such as str), since &T of type Sized all implement it by default.

Implementors§