<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `Ipv6Addr` struct in crate `std`."> <meta name="keywords" content="rust, rustlang, rust-lang, Ipv6Addr"> <title>std::net::Ipv6Addr - Rust</title> <link rel="stylesheet" type="text/css" href="../../normalize.css"> <link rel="stylesheet" type="text/css" href="../../rustdoc.css"> <link rel="stylesheet" type="text/css" href="../../main.css"> <link rel="shortcut icon" href="https://doc.rust-lang.org/favicon.ico"> </head> <body class="rustdoc struct"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <nav class="sidebar"> <a href='../../std/index.html'><img src='https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png' alt='logo' width='100'></a> <p class='location'>Struct Ipv6Addr</p><div class="block items"><ul><li><a href="#methods">Methods</a></li><li><a href="#implementations">Trait Implementations</a></li></ul></div><p class='location'><a href='../index.html'>std</a>::<wbr><a href='index.html'>net</a></p><script>window.sidebarCurrent = {name: 'Ipv6Addr', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script> </nav> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content"> <h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>std</a>::<wbr><a href='index.html'>net</a>::<wbr><a class="struct" href=''>Ipv6Addr</a></span><span class='out-of-band'><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>−</span>] </a> </span><a class='srclink' href='../../src/std/net/ip.rs.html#120-122' title='goto source code'>[src]</a></span></h1> <pre class='rust struct'>pub struct Ipv6Addr { /* fields omitted */ }</pre><div class='docblock'><p>An IPv6 address.</p> <p>IPv6 addresses are defined as 128-bit integers in <a href="https://tools.ietf.org/html/rfc4291">IETF RFC 4291</a>. They are usually represented as eight 16-bit segments.</p> <p>See <a href="../../std/net/enum.IpAddr.html"><code>IpAddr</code></a> for a type encompassing both IPv4 and IPv6 addresses.</p> <h1 id='textual-representation' class='section-header'><a href='#textual-representation'>Textual representation</a></h1> <p><code>Ipv6Addr</code> provides a <a href="../../std/str/trait.FromStr.html"><code>FromStr</code></a> implementation. There are many ways to represent an IPv6 address in text, but in general, each segments is written in hexadecimal notation, and segments are separated by <code>:</code>. For more information, see <a href="https://tools.ietf.org/html/rfc5952">IETF RFC 5952</a>.</p> <h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="kw">let</span> <span class="ident">localhost</span> <span class="op">=</span> <span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="string">"::1"</span>.<span class="ident">parse</span>(), <span class="prelude-val">Ok</span>(<span class="ident">localhost</span>)); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">localhost</span>.<span class="ident">is_loopback</span>(), <span class="bool-val">true</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Alet%20localhost%20%3D%20Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%201)%3B%0Aassert_eq!(%22%3A%3A1%22.parse()%2C%20Ok(localhost))%3B%0Aassert_eq!(localhost.is_loopback()%2C%20true)%3B%0A%7D">Run</a></pre> </div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/ip.rs.html#764-1110' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>fn <a href='#method.new' class='fnname'>new</a>(<br> a: <a class="primitive" href="../primitive.u16.html">u16</a>, <br> b: <a class="primitive" href="../primitive.u16.html">u16</a>, <br> c: <a class="primitive" href="../primitive.u16.html">u16</a>, <br> d: <a class="primitive" href="../primitive.u16.html">u16</a>, <br> e: <a class="primitive" href="../primitive.u16.html">u16</a>, <br> f: <a class="primitive" href="../primitive.u16.html">u16</a>, <br> g: <a class="primitive" href="../primitive.u16.html">u16</a>, <br> h: <a class="primitive" href="../primitive.u16.html">u16</a><br>) -> <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span></h4> <div class='docblock'><p>Creates a new IPv6 address from eight 16-bit segments.</p> <p>The result will represent the IP address a:b:c:d:e:f:g:h.</p> <h1 id='examples-1' class='section-header'><a href='#examples-1'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="kw">let</span> <span class="ident">addr</span> <span class="op">=</span> <span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Alet%20addr%20%3D%20Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff)%3B%0A%7D">Run</a></pre> </div><h4 id='method.segments' class="method"><span id='segments.v' class='invisible'><code>fn <a href='#method.segments' class='fnname'>segments</a>(&self) -> <a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u16.html">u16</a><a class="primitive" href="../primitive.array.html">; 8]</a></code></span></h4> <div class='docblock'><p>Returns the eight 16-bit segments that make up this address.</p> <h1 id='examples-2' class='section-header'><a href='#examples-2'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">segments</span>(), [<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>]);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Aassert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).segments()%2C%0A%20%20%20%20%20%20%20%20%20%20%20%5B0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff%5D)%3B%0A%7D">Run</a></pre> </div><h4 id='method.is_unspecified' class="method"><span id='is_unspecified.v' class='invisible'><code>fn <a href='#method.is_unspecified' class='fnname'>is_unspecified</a>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4> <div class='docblock'><p>Returns <a href="../../std/primitive.bool.html"><code>true</code></a> for the special 'unspecified' address (::).</p> <p>This property is defined in <a href="https://tools.ietf.org/html/rfc4291">IETF RFC 4291</a>.</p> <h1 id='examples-3' class='section-header'><a href='#examples-3'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">is_unspecified</span>(), <span class="bool-val">false</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).<span class="ident">is_unspecified</span>(), <span class="bool-val">true</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Aassert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).is_unspecified()%2C%20false)%3B%0Aassert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200).is_unspecified()%2C%20true)%3B%0A%7D">Run</a></pre> </div><h4 id='method.is_loopback' class="method"><span id='is_loopback.v' class='invisible'><code>fn <a href='#method.is_loopback' class='fnname'>is_loopback</a>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4> <div class='docblock'><p>Returns <a href="../../std/primitive.bool.html"><code>true</code></a> if this is a loopback address (::1).</p> <p>This property is defined in <a href="https://tools.ietf.org/html/rfc4291">IETF RFC 4291</a>.</p> <h1 id='examples-4' class='section-header'><a href='#examples-4'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">is_loopback</span>(), <span class="bool-val">false</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0x1</span>).<span class="ident">is_loopback</span>(), <span class="bool-val">true</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Aassert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).is_loopback()%2C%20false)%3B%0Aassert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200x1).is_loopback()%2C%20true)%3B%0A%7D">Run</a></pre> </div><h4 id='method.is_global' class="method"><span id='is_global.v' class='invisible'><code>fn <a href='#method.is_global' class='fnname'>is_global</a>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>ip </code><a href="https://github.com/rust-lang/rust/issues/27709">#27709</a>)</summary><p>extra functionality has not been scrutinized to the level that it should be stable</p> </details></div></div><div class='docblock'><p>Returns <a href="../../std/primitive.bool.html"><code>true</code></a> if the address appears to be globally routable.</p> <p>The following return <a href="../../std/primitive.bool.html"><code>false</code></a>:</p> <ul> <li>the loopback address</li> <li>link-local, site-local, and unique local unicast addresses</li> <li>interface-, link-, realm-, admin- and site-local multicast addresses</li> </ul> <h1 id='examples-5' class='section-header'><a href='#examples-5'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="attribute">#<span class="op">!</span>[<span class="ident">feature</span>(<span class="ident">ip</span>)]</span> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="kw">fn</span> <span class="ident">main</span>() { <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">is_global</span>(), <span class="bool-val">true</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0x1</span>).<span class="ident">is_global</span>(), <span class="bool-val">false</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0x1c9</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xafc8</span>, <span class="number">0</span>, <span class="number">0x1</span>).<span class="ident">is_global</span>(), <span class="bool-val">true</span>); }<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Bfeature(ip)%5D%0A%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).is_global()%2C%20true)%3B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200x1).is_global()%2C%20false)%3B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200x1c9%2C%200%2C%200%2C%200xafc8%2C%200%2C%200x1).is_global()%2C%20true)%3B%0A%7D%0A&version=nightly">Run</a></pre> </div><h4 id='method.is_unique_local' class="method"><span id='is_unique_local.v' class='invisible'><code>fn <a href='#method.is_unique_local' class='fnname'>is_unique_local</a>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>ip </code><a href="https://github.com/rust-lang/rust/issues/27709">#27709</a>)</summary><p>extra functionality has not been scrutinized to the level that it should be stable</p> </details></div></div><div class='docblock'><p>Returns <a href="../../std/primitive.bool.html"><code>true</code></a> if this is a unique local address (fc00::/7).</p> <p>This property is defined in <a href="https://tools.ietf.org/html/rfc4193">IETF RFC 4193</a>.</p> <h1 id='examples-6' class='section-header'><a href='#examples-6'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="attribute">#<span class="op">!</span>[<span class="ident">feature</span>(<span class="ident">ip</span>)]</span> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="kw">fn</span> <span class="ident">main</span>() { <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">is_unique_local</span>(), <span class="bool-val">false</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0xfc02</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).<span class="ident">is_unique_local</span>(), <span class="bool-val">true</span>); }<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Bfeature(ip)%5D%0A%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).is_unique_local()%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20false)%3B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0xfc02%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200).is_unique_local()%2C%20true)%3B%0A%7D%0A&version=nightly">Run</a></pre> </div><h4 id='method.is_unicast_link_local' class="method"><span id='is_unicast_link_local.v' class='invisible'><code>fn <a href='#method.is_unicast_link_local' class='fnname'>is_unicast_link_local</a>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>ip </code><a href="https://github.com/rust-lang/rust/issues/27709">#27709</a>)</summary><p>extra functionality has not been scrutinized to the level that it should be stable</p> </details></div></div><div class='docblock'><p>Returns <a href="../../std/primitive.bool.html"><code>true</code></a> if the address is unicast and link-local (fe80::/10).</p> <p>This property is defined in <a href="https://tools.ietf.org/html/rfc4291">IETF RFC 4291</a>.</p> <h1 id='examples-7' class='section-header'><a href='#examples-7'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="attribute">#<span class="op">!</span>[<span class="ident">feature</span>(<span class="ident">ip</span>)]</span> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="kw">fn</span> <span class="ident">main</span>() { <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">is_unicast_link_local</span>(), <span class="bool-val">false</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0xfe8a</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).<span class="ident">is_unicast_link_local</span>(), <span class="bool-val">true</span>); }<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Bfeature(ip)%5D%0A%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).is_unicast_link_local()%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20false)%3B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0xfe8a%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200).is_unicast_link_local()%2C%20true)%3B%0A%7D%0A&version=nightly">Run</a></pre> </div><h4 id='method.is_unicast_site_local' class="method"><span id='is_unicast_site_local.v' class='invisible'><code>fn <a href='#method.is_unicast_site_local' class='fnname'>is_unicast_site_local</a>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>ip </code><a href="https://github.com/rust-lang/rust/issues/27709">#27709</a>)</summary><p>extra functionality has not been scrutinized to the level that it should be stable</p> </details></div></div><div class='docblock'><p>Returns <a href="../../std/primitive.bool.html"><code>true</code></a> if this is a deprecated unicast site-local address (fec0::/10).</p> <h1 id='examples-8' class='section-header'><a href='#examples-8'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="attribute">#<span class="op">!</span>[<span class="ident">feature</span>(<span class="ident">ip</span>)]</span> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="kw">fn</span> <span class="ident">main</span>() { <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">is_unicast_site_local</span>(), <span class="bool-val">false</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0xfec2</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).<span class="ident">is_unicast_site_local</span>(), <span class="bool-val">true</span>); }<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Bfeature(ip)%5D%0A%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).is_unicast_site_local()%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20false)%3B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0xfec2%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200).is_unicast_site_local()%2C%20true)%3B%0A%7D%0A&version=nightly">Run</a></pre> </div><h4 id='method.is_documentation' class="method"><span id='is_documentation.v' class='invisible'><code>fn <a href='#method.is_documentation' class='fnname'>is_documentation</a>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>ip </code><a href="https://github.com/rust-lang/rust/issues/27709">#27709</a>)</summary><p>extra functionality has not been scrutinized to the level that it should be stable</p> </details></div></div><div class='docblock'><p>Returns <a href="../../std/primitive.bool.html"><code>true</code></a> if this is an address reserved for documentation (2001:db8::/32).</p> <p>This property is defined in <a href="https://tools.ietf.org/html/rfc3849">IETF RFC 3849</a>.</p> <h1 id='examples-9' class='section-header'><a href='#examples-9'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="attribute">#<span class="op">!</span>[<span class="ident">feature</span>(<span class="ident">ip</span>)]</span> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="kw">fn</span> <span class="ident">main</span>() { <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">is_documentation</span>(), <span class="bool-val">false</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0x2001</span>, <span class="number">0xdb8</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).<span class="ident">is_documentation</span>(), <span class="bool-val">true</span>); }<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Bfeature(ip)%5D%0A%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).is_documentation()%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20false)%3B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0x2001%2C%200xdb8%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200).is_documentation()%2C%20true)%3B%0A%7D%0A&version=nightly">Run</a></pre> </div><h4 id='method.is_unicast_global' class="method"><span id='is_unicast_global.v' class='invisible'><code>fn <a href='#method.is_unicast_global' class='fnname'>is_unicast_global</a>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>ip </code><a href="https://github.com/rust-lang/rust/issues/27709">#27709</a>)</summary><p>extra functionality has not been scrutinized to the level that it should be stable</p> </details></div></div><div class='docblock'><p>Returns <a href="../../std/primitive.bool.html"><code>true</code></a> if the address is a globally routable unicast address.</p> <p>The following return false:</p> <ul> <li>the loopback address</li> <li>the link-local addresses</li> <li>the (deprecated) site-local addresses</li> <li>unique local addresses</li> <li>the unspecified address</li> <li>the address range reserved for documentation</li> </ul> <h1 id='examples-10' class='section-header'><a href='#examples-10'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="attribute">#<span class="op">!</span>[<span class="ident">feature</span>(<span class="ident">ip</span>)]</span> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="kw">fn</span> <span class="ident">main</span>() { <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0x2001</span>, <span class="number">0xdb8</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).<span class="ident">is_unicast_global</span>(), <span class="bool-val">false</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">is_unicast_global</span>(), <span class="bool-val">true</span>); }<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Bfeature(ip)%5D%0A%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0x2001%2C%200xdb8%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200).is_unicast_global()%2C%20false)%3B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).is_unicast_global()%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20true)%3B%0A%7D%0A&version=nightly">Run</a></pre> </div><h4 id='method.multicast_scope' class="method"><span id='multicast_scope.v' class='invisible'><code>fn <a href='#method.multicast_scope' class='fnname'>multicast_scope</a>(&self) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><<a class="enum" href="../../std/net/enum.Ipv6MulticastScope.html" title="enum std::net::Ipv6MulticastScope">Ipv6MulticastScope</a>></code></span></h4> <div class='stability'><div class='stab unstable'><details><summary><span class=microscope>🔬</span> This is a nightly-only experimental API. (<code>ip </code><a href="https://github.com/rust-lang/rust/issues/27709">#27709</a>)</summary><p>extra functionality has not been scrutinized to the level that it should be stable</p> </details></div></div><div class='docblock'><p>Returns the address's multicast scope if the address is multicast.</p> <h1 id='examples-11' class='section-header'><a href='#examples-11'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="attribute">#<span class="op">!</span>[<span class="ident">feature</span>(<span class="ident">ip</span>)]</span> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::{<span class="ident">Ipv6Addr</span>, <span class="ident">Ipv6MulticastScope</span>}; <span class="kw">fn</span> <span class="ident">main</span>() { <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0xff0e</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).<span class="ident">multicast_scope</span>(), <span class="prelude-val">Some</span>(<span class="ident">Ipv6MulticastScope</span>::<span class="ident">Global</span>)); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">multicast_scope</span>(), <span class="prelude-val">None</span>); }<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=%23!%5Bfeature(ip)%5D%0A%0Ause%20std%3A%3Anet%3A%3A%7BIpv6Addr%2C%20Ipv6MulticastScope%7D%3B%0A%0Afn%20main()%20%7B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0xff0e%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200).multicast_scope()%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Some(Ipv6MulticastScope%3A%3AGlobal))%3B%0A%20%20%20%20assert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).multicast_scope()%2C%20None)%3B%0A%7D%0A&version=nightly">Run</a></pre> </div><h4 id='method.is_multicast' class="method"><span id='is_multicast.v' class='invisible'><code>fn <a href='#method.is_multicast' class='fnname'>is_multicast</a>(&self) -> <a class="primitive" href="../primitive.bool.html">bool</a></code><div class='since' title='Stable since Rust version 1.7.0'>1.7.0</div></span></h4> <div class='docblock'><p>Returns <a href="../../std/primitive.bool.html"><code>true</code></a> if this is a multicast address (ff00::/8).</p> <p>This property is defined by <a href="https://tools.ietf.org/html/rfc4291">IETF RFC 4291</a>.</p> <h1 id='examples-12' class='section-header'><a href='#examples-12'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0xff00</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).<span class="ident">is_multicast</span>(), <span class="bool-val">true</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">is_multicast</span>(), <span class="bool-val">false</span>);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Aassert_eq!(Ipv6Addr%3A%3Anew(0xff00%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200).is_multicast()%2C%20true)%3B%0Aassert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).is_multicast()%2C%20false)%3B%0A%7D">Run</a></pre> </div><h4 id='method.to_ipv4' class="method"><span id='to_ipv4.v' class='invisible'><code>fn <a href='#method.to_ipv4' class='fnname'>to_ipv4</a>(&self) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><<a class="struct" href="../../std/net/struct.Ipv4Addr.html" title="struct std::net::Ipv4Addr">Ipv4Addr</a>></code></span></h4> <div class='docblock'><p>Converts this address to an <a href="../../std/net/struct.Ipv4Addr.html">IPv4 address</a>. Returns <a href="../../std/option/enum.Option.html#variant.None"><code>None</code></a> if this address is neither IPv4-compatible or IPv4-mapped.</p> <p>::a.b.c.d and ::ffff:a.b.c.d become a.b.c.d</p> <h1 id='examples-13' class='section-header'><a href='#examples-13'>Examples</a></h1> <pre class="rust rust-example-rendered"> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::{<span class="ident">Ipv4Addr</span>, <span class="ident">Ipv6Addr</span>}; <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0xff00</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).<span class="ident">to_ipv4</span>(), <span class="prelude-val">None</span>); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0xffff</span>, <span class="number">0xc00a</span>, <span class="number">0x2ff</span>).<span class="ident">to_ipv4</span>(), <span class="prelude-val">Some</span>(<span class="ident">Ipv4Addr</span>::<span class="ident">new</span>(<span class="number">192</span>, <span class="number">10</span>, <span class="number">2</span>, <span class="number">255</span>))); <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>).<span class="ident">to_ipv4</span>(), <span class="prelude-val">Some</span>(<span class="ident">Ipv4Addr</span>::<span class="ident">new</span>(<span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">1</span>)));<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3A%7BIpv4Addr%2C%20Ipv6Addr%7D%3B%0A%0Aassert_eq!(Ipv6Addr%3A%3Anew(0xff00%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200).to_ipv4()%2C%20None)%3B%0Aassert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200xffff%2C%200xc00a%2C%200x2ff).to_ipv4()%2C%0A%20%20%20%20%20%20%20%20%20%20%20Some(Ipv4Addr%3A%3Anew(192%2C%2010%2C%202%2C%20255)))%3B%0Aassert_eq!(Ipv6Addr%3A%3Anew(0%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%201).to_ipv4()%2C%0A%20%20%20%20%20%20%20%20%20%20%20Some(Ipv4Addr%3A%3Anew(0%2C%200%2C%200%2C%201)))%3B%0A%7D">Run</a></pre> </div><h4 id='method.octets' class="method"><span id='octets.v' class='invisible'><code>fn <a href='#method.octets' class='fnname'>octets</a>(&self) -> <a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.array.html">; 16]</a></code><div class='since' title='Stable since Rust version 1.12.0'>1.12.0</div></span></h4> <div class='docblock'><p>Returns the sixteen eight-bit integers the IPv6 address consists of.</p> <pre class="rust rust-example-rendered"> <span class="kw">use</span> <span class="ident">std</span>::<span class="ident">net</span>::<span class="ident">Ipv6Addr</span>; <span class="macro">assert_eq</span><span class="macro">!</span>(<span class="ident">Ipv6Addr</span>::<span class="ident">new</span>(<span class="number">0xff00</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>).<span class="ident">octets</span>(), [<span class="number">255</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>]);<a class="test-arrow" target="_blank" href="https://play.rust-lang.org/?code=fn%20main()%20%7B%0Ause%20std%3A%3Anet%3A%3AIpv6Addr%3B%0A%0Aassert_eq!(Ipv6Addr%3A%3Anew(0xff00%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200).octets()%2C%0A%20%20%20%20%20%20%20%20%20%20%20%5B255%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%2C%200%5D)%3B%0A%7D">Run</a></pre> </div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/marker/trait.Copy.html" title="trait std::marker::Copy">Copy</a> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/ip.rs.html#118' title='goto source code'>[src]</a></span></h3> <div class='impl-items'></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/fmt/trait.Display.html" title="trait std::fmt::Display">Display</a> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/ip.rs.html#1113-1182' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='../../std/fmt/trait.Display.html#tymethod.fmt' class='fnname'>fmt</a>(&self, fmt: &mut <a class="struct" href="../../std/fmt/struct.Formatter.html" title="struct std::fmt::Formatter">Formatter</a>) -> <a class="type" href="../../std/fmt/type.Result.html" title="type std::fmt::Result">Result</a></code></span></h4> <div class='docblock'><p>Formats the value using the given formatter. <a href="../../std/fmt/trait.Display.html#tymethod.fmt">Read more</a></p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/fmt/trait.Debug.html" title="trait std::fmt::Debug">Debug</a> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/ip.rs.html#1185-1189' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.fmt-1' class="method"><span id='fmt.v-1' class='invisible'><code>fn <a href='../../std/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&self, fmt: &mut <a class="struct" href="../../std/fmt/struct.Formatter.html" title="struct std::fmt::Formatter">Formatter</a>) -> <a class="type" href="../../std/fmt/type.Result.html" title="type std::fmt::Result">Result</a></code></span></h4> <div class='docblock'><p>Formats the value using the given formatter.</p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/clone/trait.Clone.html" title="trait std::clone::Clone">Clone</a> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/ip.rs.html#1192-1194' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.clone' class="method"><span id='clone.v' class='invisible'><code>fn <a href='../../std/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&self) -> <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span></h4> <div class='docblock'><p>Returns a copy of the value. <a href="../../std/clone/trait.Clone.html#tymethod.clone">Read more</a></p> </div><h4 id='method.clone_from' class="method"><span id='clone_from.v' class='invisible'><code>fn <a href='../../std/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&mut self, source: &Self)</code></span></h4> <div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="../../std/clone/trait.Clone.html#method.clone_from">Read more</a></p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/ip.rs.html#1197-1201' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.eq' class="method"><span id='eq.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a>) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p> </div><h4 id='method.ne' class="method"><span id='ne.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: &Rhs) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests for <code>!=</code>.</p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/cmp/trait.PartialEq.html" title="trait std::cmp::PartialEq">PartialEq</a><<a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a>> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.16.0'>1.16.0</div><a class='srclink' href='../../src/std/net/ip.rs.html#1204-1211' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.eq-1' class="method"><span id='eq.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&self, other: &<a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a>) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used by <code>==</code>. <a href="../../std/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p> </div><h4 id='method.ne-1' class="method"><span id='ne.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&self, other: &Rhs) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests for <code>!=</code>.</p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/cmp/trait.Eq.html" title="trait std::cmp::Eq">Eq</a> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/ip.rs.html#1224' title='goto source code'>[src]</a></span></h3> <div class='impl-items'></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/hash/trait.Hash.html" title="trait std::hash::Hash">Hash</a> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/ip.rs.html#1227-1231' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.hash' class="method"><span id='hash.v' class='invisible'><code>fn <a href='../../std/hash/trait.Hash.html#tymethod.hash' class='fnname'>hash</a><H: <a class="trait" href="../../std/hash/trait.Hasher.html" title="trait std::hash::Hasher">Hasher</a>>(&self, s: &mut H)</code></span></h4> <div class='docblock'><p>Feeds this value into the given [<code>Hasher</code>]. <a href="../../std/hash/trait.Hash.html#tymethod.hash">Read more</a></p> </div><h4 id='method.hash_slice' class="method"><span id='hash_slice.v' class='invisible'><code>fn <a href='../../std/hash/trait.Hash.html#method.hash_slice' class='fnname'>hash_slice</a><H>(data: <a class="primitive" href="../primitive.slice.html">&[Self]</a>, state: &mut H) <span class="where fmt-newline">where<br> H: <a class="trait" href="../../std/hash/trait.Hasher.html" title="trait std::hash::Hasher">Hasher</a>, </span></code><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div></span></h4> <div class='docblock'><p>Feeds a slice of this type into the given [<code>Hasher</code>]. <a href="../../std/hash/trait.Hash.html#method.hash_slice">Read more</a></p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/ip.rs.html#1234-1238' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.partial_cmp' class="method"><span id='partial_cmp.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a>) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><<a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>></code></span></h4> <div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p> </div><h4 id='method.lt' class="method"><span id='lt.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: &Rhs) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p> </div><h4 id='method.le' class="method"><span id='le.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: &Rhs) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p> </div><h4 id='method.gt' class="method"><span id='gt.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: &Rhs) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p> </div><h4 id='method.ge' class="method"><span id='ge.v' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: &Rhs) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.ge">Read more</a></p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/cmp/trait.PartialOrd.html" title="trait std::cmp::PartialOrd">PartialOrd</a><<a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a>> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.16.0'>1.16.0</div><a class='srclink' href='../../src/std/net/ip.rs.html#1251-1258' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.partial_cmp-1' class="method"><span id='partial_cmp.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&self, other: &<a class="enum" href="../../std/net/enum.IpAddr.html" title="enum std::net::IpAddr">IpAddr</a>) -> <a class="enum" href="../../std/option/enum.Option.html" title="enum std::option::Option">Option</a><<a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a>></code></span></h4> <div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="../../std/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p> </div><h4 id='method.lt-1' class="method"><span id='lt.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&self, other: &Rhs) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code><</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.lt">Read more</a></p> </div><h4 id='method.le-1' class="method"><span id='le.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&self, other: &Rhs) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests less than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code><=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.le">Read more</a></p> </div><h4 id='method.gt-1' class="method"><span id='gt.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&self, other: &Rhs) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>></code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.gt">Read more</a></p> </div><h4 id='method.ge-1' class="method"><span id='ge.v-1' class='invisible'><code>fn <a href='../../std/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&self, other: &Rhs) -> <a class="primitive" href="../primitive.bool.html">bool</a></code></span></h4> <div class='docblock'><p>This method tests greater than or equal to (for <code>self</code> and <code>other</code>) and is used by the <code>>=</code> operator. <a href="../../std/cmp/trait.PartialOrd.html#method.ge">Read more</a></p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/cmp/trait.Ord.html" title="trait std::cmp::Ord">Ord</a> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/ip.rs.html#1261-1265' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.cmp' class="method"><span id='cmp.v' class='invisible'><code>fn <a href='../../std/cmp/trait.Ord.html#tymethod.cmp' class='fnname'>cmp</a>(&self, other: &<a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a>) -> <a class="enum" href="../../std/cmp/enum.Ordering.html" title="enum std::cmp::Ordering">Ordering</a></code></span></h4> <div class='docblock'><p>This method returns an <code>Ordering</code> between <code>self</code> and <code>other</code>. <a href="../../std/cmp/trait.Ord.html#tymethod.cmp">Read more</a></p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a><<a class="primitive" href="../primitive.u128.html">u128</a>> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/ip.rs.html#1286-1294' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.from' class="method"><span id='from.v' class='invisible'><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(ip: <a class="primitive" href="../primitive.u128.html">u128</a>) -> <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span></h4> <div class='docblock'><p>Performs the conversion.</p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a><<a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.array.html">; 16]</a>> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.9.0'>1.9.0</div><a class='srclink' href='../../src/std/net/ip.rs.html#1297-1303' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.from-1' class="method"><span id='from.v-1' class='invisible'><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(octets: <a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u8.html">u8</a><a class="primitive" href="../primitive.array.html">; 16]</a>) -> <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span></h4> <div class='docblock'><p>Performs the conversion.</p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/convert/trait.From.html" title="trait std::convert::From">From</a><<a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u16.html">u16</a><a class="primitive" href="../primitive.array.html">; 8]</a>> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><div class='since' title='Stable since Rust version 1.16.0'>1.16.0</div><a class='srclink' href='../../src/std/net/ip.rs.html#1306-1311' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.from-2' class="method"><span id='from.v-2' class='invisible'><code>fn <a href='../../std/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(segments: <a class="primitive" href="../primitive.array.html">[</a><a class="primitive" href="../primitive.u16.html">u16</a><a class="primitive" href="../primitive.array.html">; 8]</a>) -> <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span></h4> <div class='docblock'><p>Performs the conversion.</p> </div></div><h3 class='impl'><span class='in-band'><code>impl <a class="trait" href="../../std/str/trait.FromStr.html" title="trait std::str::FromStr">FromStr</a> for <a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/std/net/parser.rs.html#328-336' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='associatedtype.Err' class="type"><span id='Err.t' class='invisible'><code>type <a href='../../std/str/trait.FromStr.html#associatedtype.Err' class="type">Err</a> = <a class="struct" href="../../std/net/struct.AddrParseError.html" title="struct std::net::AddrParseError">AddrParseError</a></code></span></h4> <div class='docblock'><p>The associated error which can be returned from parsing.</p> </div><h4 id='method.from_str' class="method"><span id='from_str.v' class='invisible'><code>fn <a href='../../std/str/trait.FromStr.html#tymethod.from_str' class='fnname'>from_str</a>(s: &<a class="primitive" href="../primitive.str.html">str</a>) -> <a class="enum" href="../../std/result/enum.Result.html" title="enum std::result::Result">Result</a><<a class="struct" href="../../std/net/struct.Ipv6Addr.html" title="struct std::net::Ipv6Addr">Ipv6Addr</a>, <a class="struct" href="../../std/net/struct.AddrParseError.html" title="struct std::net::AddrParseError">AddrParseError</a>></code></span></h4> <div class='docblock'><p>Parses a string <code>s</code> to return a value of this type. <a href="../../std/str/trait.FromStr.html#tymethod.from_str">Read more</a></p> </div></div></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <aside id="help" class="hidden"> <div> <h1 class="hidden">Help</h1> <div class="shortcuts"> <h2>Keyboard Shortcuts</h2> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>⇤</dt> <dd>Move up in search results</dd> <dt>⇥</dt> <dd>Move down in search results</dd> <dt>⏎</dt> <dd>Go to active search result</dd> <dt>+</dt> <dd>Collapse/expand all sections</dd> </dl> </div> <div class="infos"> <h2>Search Tricks</h2> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>) </p> </div> </div> </aside> <script> window.rootPath = "../../"; window.currentCrate = "std"; </script> <script src="../../main.js"></script> <script defer src="../../search-index.js"></script> </body> </html>