ToSocketAddrs in async_std::net - Rust (original) (raw)

Trait ToSocketAddrs

Source

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

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

Expand description

Converts or resolves addresses to SocketAddr values.

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

§Examples

use async_std:🥅:ToSocketAddrs;

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

Source

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

Source

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.

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§

Source§