cap_async_std::net

Trait ToSocketAddrs

Source
pub trait ToSocketAddrs {
    type Iter: Iterator<Item = SocketAddr>;

    // Required method
    fn to_socket_addrs(&self) -> ToSocketAddrsFuture<Self::Iter>;
}
Expand description

Converts or resolves addresses to SocketAddr values.

This trait is an async version of std::net::ToSocketAddrs.

§Examples

use async_std::net::ToSocketAddrs;

let addr = "localhost:8080".to_socket_addrs().await?.next().unwrap();
println!("resolved: {:?}", addr);

Required Associated Types§

Source

type Iter: Iterator<Item = SocketAddr>

Returned iterator over socket addresses which this type may correspond to.

Required Methods§

Source

fn to_socket_addrs(&self) -> ToSocketAddrsFuture<Self::Iter>

Converts this object to an iterator of resolved SocketAddrs.

The returned iterator may not actually yield any values depending on the outcome of any resolution performed.

Note that this function may block a backend thread while resolution is performed.

Implementations on Foreign Types§

Source§

impl ToSocketAddrs for (&str, u16)

Source§

type Iter = IntoIter<SocketAddr>

Source§

fn to_socket_addrs( &self, ) -> ToSocketAddrsFuture<<(&str, u16) as ToSocketAddrs>::Iter>

Source§

impl ToSocketAddrs for (IpAddr, u16)

Source§

type Iter = IntoIter<SocketAddr>

Source§

fn to_socket_addrs( &self, ) -> ToSocketAddrsFuture<<(IpAddr, u16) as ToSocketAddrs>::Iter>

Source§

impl ToSocketAddrs for (Ipv4Addr, u16)

Source§

type Iter = IntoIter<SocketAddr>

Source§

fn to_socket_addrs( &self, ) -> ToSocketAddrsFuture<<(Ipv4Addr, u16) as ToSocketAddrs>::Iter>

Source§

impl ToSocketAddrs for (Ipv6Addr, u16)

Source§

type Iter = IntoIter<SocketAddr>

Source§

fn to_socket_addrs( &self, ) -> ToSocketAddrsFuture<<(Ipv6Addr, u16) as ToSocketAddrs>::Iter>

Source§

impl ToSocketAddrs for str

Source§

type Iter = IntoIter<SocketAddr>

Source§

fn to_socket_addrs(&self) -> ToSocketAddrsFuture<<str as ToSocketAddrs>::Iter>

Source§

impl ToSocketAddrs for String

Source§

type Iter = IntoIter<SocketAddr>

Source§

fn to_socket_addrs( &self, ) -> ToSocketAddrsFuture<<String as ToSocketAddrs>::Iter>

Source§

impl<'a> ToSocketAddrs for &'a [SocketAddr]

Source§

type Iter = Cloned<Iter<'a, SocketAddr>>

Source§

fn to_socket_addrs( &self, ) -> ToSocketAddrsFuture<<&'a [SocketAddr] as ToSocketAddrs>::Iter>

Source§

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

Source§

type Iter = <T as ToSocketAddrs>::Iter

Source§

fn to_socket_addrs(&self) -> ToSocketAddrsFuture<<&T as ToSocketAddrs>::Iter>

Implementors§