1use std::{future, io, net::SocketAddr};
2
3pub trait AsyncToSocketAddrs {
5 fn to_socket_addrs(
7 self,
8 ) -> impl Future<Output = io::Result<impl Iterator<Item = SocketAddr> + Send + 'static>>
9 + Send
10 + 'static
11 where
12 Self: Sized;
13}
14
15impl<A: Into<SocketAddr>> AsyncToSocketAddrs for A {
16 fn to_socket_addrs(
17 self,
18 ) -> impl Future<Output = io::Result<impl Iterator<Item = SocketAddr> + Send + 'static>>
19 + Send
20 + 'static {
21 future::ready(Ok(Some(self.into()).into_iter()))
22 }
23}