Skip to content

Commit

Permalink
Auto merge of #30188 - tshepang:lookup_addr-example, r=alexcrichton
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Dec 7, 2015
2 parents e819d8a + 8569ef2 commit 7b77f67
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/libstd/net/mod.rs
Expand Up @@ -135,6 +135,22 @@ pub fn lookup_host(host: &str) -> io::Result<LookupHost> {
/// This function may perform a DNS query to resolve `addr` and may also inspect
/// system configuration to resolve the specified address. If the address
/// cannot be resolved, it is returned in string format.
///
/// # Examples
///
/// ```no_run
/// #![feature(lookup_addr)]
/// #![feature(ip_addr)]
///
/// use std::net::{self, Ipv4Addr, IpAddr};
///
/// let ip_addr = "8.8.8.8";
/// let addr: Ipv4Addr = ip_addr.parse().unwrap();
/// let hostname = net::lookup_addr(&IpAddr::V4(addr)).unwrap();
///
/// println!("{} --> {}", ip_addr, hostname);
/// // Output: 8.8.8.8 --> google-public-dns-a.google.com
/// ```
#[unstable(feature = "lookup_addr", reason = "recent addition",
issue = "27705")]
#[rustc_deprecated(reason = "ipaddr type is being deprecated",
Expand Down

0 comments on commit 7b77f67

Please sign in to comment.