# Struct std::net::Ipv6Addr [−] [src]

    pub struct Ipv6Addr {
        // some fields omitted
    }

Representation of an IPv6 address.

## Methods

### `impl Ipv6Addr`

#### `fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, g: u16, h: u16) -> Ipv6Addr`

Creates a new IPv6 address from eight 16-bit segments.

The result will represent the IP address a:b:c:d:e:f:g:h.

#### `fn segments(&self) -> [u16; 8]`

Returns the eight 16-bit segments that make up this address.

#### `fn is_unspecified(&self) -> bool`

Returns true for the special 'unspecified' address ::.

This property is defined in RFC 6890.

#### `fn is_loopback(&self) -> bool`

Returns true if this is a loopback address (::1).

This property is defined in RFC 6890.

#### `fn is_global(&self) -> bool`

Unstable (`ip` #27709)

: extra functionality has not been scrutinized to the level that it should be stable

Returns true if the address appears to be globally routable.

The following return false:

- the loopback address
- link-local, site-local, and unique local unicast addresses
- interface-, link-, realm-, admin- and site-local multicast addresses

#### `fn is_unique_local(&self) -> bool`

Unstable (`ip` #27709)

: extra functionality has not been scrutinized to the level that it should be stable

Returns true if this is a unique local address (IPv6).

Unique local addresses are defined in RFC4193 and have the form fc00::/7.

#### `fn is_unicast_link_local(&self) -> bool`

Unstable (`ip` #27709)

: extra functionality has not been scrutinized to the level that it should be stable

Returns true if the address is unicast and link-local (fe80::/10).

#### `fn is_unicast_site_local(&self) -> bool`

Unstable (`ip` #27709)

: extra functionality has not been scrutinized to the level that it should be stable

Returns true if this is a deprecated unicast site-local address (IPv6 fec0::/10).

#### `fn is_unicast_global(&self) -> bool`

Unstable (`ip` #27709)

: extra functionality has not been scrutinized to the level that it should be stable

Returns true if the address is a globally routable unicast address.

The following return false:

- the loopback address
- the link-local addresses
- the (deprecated) site-local addresses
- unique local addresses

#### `fn multicast_scope(&self) -> Option<Ipv6MulticastScope>`

Unstable (`ip` #27709)

: extra functionality has not been scrutinized to the level that it should be stable

Returns the address's multicast scope if the address is multicast.

#### `fn is_multicast(&self) -> bool`

Returns true if this is a multicast address.

Multicast addresses have the form ff00::/8, and this property is defined by RFC 3956.

#### `fn to_ipv4(&self) -> Option<Ipv4Addr>`

Converts this address to an IPv4 address. Returns None if this address is neither IPv4-compatible or IPv4-mapped.

::a.b.c.d and ::ffff:a.b.c.d become a.b.c.d

## Trait Implementations

### `impl Display for Ipv6Addr`

#### `fn fmt(&self, fmt: &mut Formatter) -> Result`

### `impl Debug for Ipv6Addr`

#### `fn fmt(&self, fmt: &mut Formatter) -> Result`

### `impl Clone for Ipv6Addr`

#### `fn clone(&self) -> Ipv6Addr`

#### `fn clone_from(&mut self, source: &Self)`

### `impl PartialEq for Ipv6Addr`

#### `fn eq(&self, other: &Ipv6Addr) -> bool`

#### `fn ne(&self, other: &Rhs) -> bool`

### `impl Eq for Ipv6Addr`

### `impl Hash for Ipv6Addr`

#### `fn hash<H: Hasher>(&self, s: &mut H)`

#### `fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher`

### `impl PartialOrd for Ipv6Addr`

#### `fn partial_cmp(&self, other: &Ipv6Addr) -> Option<Ordering>`

#### `fn lt(&self, other: &Rhs) -> bool`

#### `fn le(&self, other: &Rhs) -> bool`

#### `fn gt(&self, other: &Rhs) -> bool`

#### `fn ge(&self, other: &Rhs) -> bool`

### `impl Ord for Ipv6Addr`

#### `fn cmp(&self, other: &Ipv6Addr) -> Ordering`

### `impl FromStr for Ipv6Addr`

#### `type Err = AddrParseError`

#### `fn from_str(s: &str) -> Result<Ipv6Addr, AddrParseError>`

### Derived Implementations

### `impl Copy for Ipv6Addr`

# 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`)