|
38 | 38 |
|
39 | 39 | #![stable(feature = "rust1", since = "1.0.0")] |
40 | 40 |
|
41 | | -use fmt; |
42 | 41 | use io::{self, Error, ErrorKind}; |
43 | | -use sys_common::net as net_imp; |
44 | 42 |
|
45 | 43 | #[stable(feature = "rust1", since = "1.0.0")] |
46 | 44 | pub use self::ip::{IpAddr, Ipv4Addr, Ipv6Addr, Ipv6MulticastScope}; |
@@ -128,66 +126,3 @@ fn each_addr<A: ToSocketAddrs, F, T>(addr: A, mut f: F) -> io::Result<T> |
128 | 126 | "could not resolve to any addresses") |
129 | 127 | })) |
130 | 128 | } |
131 | | - |
132 | | -/// An iterator over `SocketAddr` values returned from a host lookup operation. |
133 | | -#[unstable(feature = "lookup_host", reason = "unsure about the returned \ |
134 | | - iterator and returning socket \ |
135 | | - addresses", |
136 | | - issue = "27705")] |
137 | | -#[rustc_deprecated(since = "1.25.0", reason = "Use the ToSocketAddrs trait instead")] |
138 | | -pub struct LookupHost(net_imp::LookupHost); |
139 | | - |
140 | | -#[unstable(feature = "lookup_host", reason = "unsure about the returned \ |
141 | | - iterator and returning socket \ |
142 | | - addresses", |
143 | | - issue = "27705")] |
144 | | -#[rustc_deprecated(since = "1.25.0", reason = "Use the ToSocketAddrs trait instead")] |
145 | | -#[allow(deprecated)] |
146 | | -impl Iterator for LookupHost { |
147 | | - type Item = SocketAddr; |
148 | | - fn next(&mut self) -> Option<SocketAddr> { self.0.next() } |
149 | | -} |
150 | | - |
151 | | -#[unstable(feature = "lookup_host", reason = "unsure about the returned \ |
152 | | - iterator and returning socket \ |
153 | | - addresses", |
154 | | - issue = "27705")] |
155 | | -#[rustc_deprecated(since = "1.25.0", reason = "Use the ToSocketAddrs trait instead")] |
156 | | -#[allow(deprecated)] |
157 | | -impl fmt::Debug for LookupHost { |
158 | | - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { |
159 | | - f.pad("LookupHost { .. }") |
160 | | - } |
161 | | -} |
162 | | - |
163 | | -/// Resolve the host specified by `host` as a number of `SocketAddr` instances. |
164 | | -/// |
165 | | -/// This method may perform a DNS query to resolve `host` and may also inspect |
166 | | -/// system configuration to resolve the specified hostname. |
167 | | -/// |
168 | | -/// The returned iterator will skip over any unknown addresses returned by the |
169 | | -/// operating system. |
170 | | -/// |
171 | | -/// # Examples |
172 | | -/// |
173 | | -/// ```no_run |
174 | | -/// #![feature(lookup_host)] |
175 | | -/// |
176 | | -/// use std::net; |
177 | | -/// |
178 | | -/// fn main() -> std::io::Result<()> { |
179 | | -/// for host in net::lookup_host("rust-lang.org")? { |
180 | | -/// println!("found address: {}", host); |
181 | | -/// } |
182 | | -/// Ok(()) |
183 | | -/// } |
184 | | -/// ``` |
185 | | -#[unstable(feature = "lookup_host", reason = "unsure about the returned \ |
186 | | - iterator and returning socket \ |
187 | | - addresses", |
188 | | - issue = "27705")] |
189 | | -#[rustc_deprecated(since = "1.25.0", reason = "Use the ToSocketAddrs trait instead")] |
190 | | -#[allow(deprecated)] |
191 | | -pub fn lookup_host(host: &str) -> io::Result<LookupHost> { |
192 | | - net_imp::lookup_host(host).map(LookupHost) |
193 | | -} |
0 commit comments