# Function std::net::lookup_addr [−] [src]

    pub fn lookup_addr(addr: &IpAddr) -> Result<String>

Deprecated since 1.6.0

: ipaddr type is being deprecated

Resolve the given address to a hostname.

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

#![feature(lookup_addr)] fn main() { 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 }

    #![feature(lookup_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

# Help

## Keyboard Shortcuts

?
  Show this help dialog
S
  Focus the search field
⇤
  Move up in search results
⇥
  Move down in search results
⏎
  Go to active search result

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize`)