ToSocketAddrs

Trait ToSocketAddrs 

Source
pub trait ToSocketAddrs<R>: Send + Sync {
    type Iter: Iterator<Item = SocketAddr> + Send + 'static;
    type Future: Future<Output = Result<Self::Iter>> + Send + 'static;

    // Required method
    fn to_socket_addrs(&self) -> Self::Future
       where R: RuntimeLite;
}
Expand description

Converts or resolves without blocking base on your async runtime to one or more SocketAddr values.

§DNS

Implementations of ToSocketAddrs<R> for string types require a DNS lookup.

Required Associated Types§

Source

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

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

Source

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

The future type used to resolve addresses.

Required Methods§

Source

fn to_socket_addrs(&self) -> Self::Future
where R: RuntimeLite,

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<R: RuntimeLite> ToSocketAddrs<R> for (&str, u16)
where ToSocketAddrsFuture<<R::BlockingSpawner as AsyncBlockingSpawner>::JoinHandle<Result<OneOrMore>>>: Future<Output = Result<OneOrMore>> + Send,

Source§

type Iter = OneOrMore

Source§

type Future = ToSocketAddrsFuture<<<R as RuntimeLite>::BlockingSpawner as AsyncBlockingSpawner>::JoinHandle<Result<OneOrMore, Error>>>

Source§

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

Source§

impl<R: RuntimeLite> ToSocketAddrs<R> for (IpAddr, u16)

Source§

impl<R: RuntimeLite> ToSocketAddrs<R> for (String, u16)
where ToSocketAddrsFuture<<R::BlockingSpawner as AsyncBlockingSpawner>::JoinHandle<Result<OneOrMore>>>: Future<Output = Result<OneOrMore>> + Send,

Source§

type Iter = OneOrMore

Source§

type Future = ToSocketAddrsFuture<<<R as RuntimeLite>::BlockingSpawner as AsyncBlockingSpawner>::JoinHandle<Result<OneOrMore, Error>>>

Source§

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

Source§

impl<R: RuntimeLite> ToSocketAddrs<R> for (Ipv4Addr, u16)

Source§

impl<R: RuntimeLite> ToSocketAddrs<R> for (Ipv6Addr, u16)

Source§

impl<R: RuntimeLite> ToSocketAddrs<R> for SocketAddr

Source§

impl<R: RuntimeLite> ToSocketAddrs<R> for str
where ToSocketAddrsFuture<<R::BlockingSpawner as AsyncBlockingSpawner>::JoinHandle<Result<OneOrMore>>>: Future<Output = Result<OneOrMore>> + Send,

Source§

type Iter = OneOrMore

Source§

type Future = ToSocketAddrsFuture<<<R as RuntimeLite>::BlockingSpawner as AsyncBlockingSpawner>::JoinHandle<Result<OneOrMore, Error>>>

Source§

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

Source§

impl<R: RuntimeLite> ToSocketAddrs<R> for String
where ToSocketAddrsFuture<<R::BlockingSpawner as AsyncBlockingSpawner>::JoinHandle<Result<OneOrMore>>>: Future<Output = Result<OneOrMore>> + Send,

Source§

impl<R: RuntimeLite> ToSocketAddrs<R> for SocketAddrV4

Source§

impl<R: RuntimeLite> ToSocketAddrs<R> for SocketAddrV6

Source§

impl<R: RuntimeLite> ToSocketAddrs<R> for [SocketAddr]

Source§

impl<T, R: RuntimeLite> ToSocketAddrs<R> for &T
where T: ToSocketAddrs<R> + ?Sized + Send + Sync,

Implementors§