juniper/url/struct.Url.html
Juniper Documentation Builder 95d942c9d4 Update documentation for Juniper
2016-09-11 18:41:24 +00:00

479 lines
No EOL
61 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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 `Url` struct in crate `url`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Url">
<title>url::Url - Rust</title>
<link rel="stylesheet" type="text/css" href="../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../main.css">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'><a href='index.html'>url</a></p><script>window.sidebarCurrent = {name: 'Url', 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 struct">
<h1 class='fqn'><span class='in-band'>Struct <a href='index.html'>url</a>::<wbr><a class='struct' href=''>Url</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a id='src-1685' class='srclink' href='../src/url/lib.rs.html#157-179' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Url {
// some fields omitted
}</pre><div class='docblock'><p>A parsed URL record.</p>
</div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1721' class='srclink' href='../src/url/lib.rs.html#229-1157' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.parse' class='method'><code>fn <a href='#method.parse' class='fnname'>parse</a>(input: &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a>,&nbsp;<a class='enum' href='../url/enum.ParseError.html' title='url::ParseError'>ParseError</a>&gt;</code></h4>
<div class='docblock'><p>Parse an absolute URL from a string.</p>
</div><h4 id='method.join' class='method'><code>fn <a href='#method.join' class='fnname'>join</a>(&amp;self, input: &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a>,&nbsp;<a class='enum' href='../url/enum.ParseError.html' title='url::ParseError'>ParseError</a>&gt;</code></h4>
<div class='docblock'><p>Parse a string as an URL, with this URL as the base URL.</p>
</div><h4 id='method.options' class='method'><code>fn <a href='#method.options' class='fnname'>options</a>&lt;'a&gt;() -&gt; <a class='struct' href='../url/struct.ParseOptions.html' title='url::ParseOptions'>ParseOptions</a>&lt;'a&gt;</code></h4>
<div class='docblock'><p>Return a default <code>ParseOptions</code> that can fully configure the URL parser.</p>
</div><h4 id='method.as_str' class='method'><code>fn <a href='#method.as_str' class='fnname'>as_str</a>(&amp;self) -&gt; &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>Return the serialization of this URL.</p>
<p>This is fast since that serialization is already stored in the <code>Url</code> struct.</p>
</div><h4 id='method.into_string' class='method'><code>fn <a href='#method.into_string' class='fnname'>into_string</a>(self) -&gt; <a class='struct' href='https://doc.rust-lang.org/nightly/collections/string/struct.String.html' title='collections::string::String'>String</a></code></h4>
<div class='docblock'><p>Return the serialization of this URL.</p>
<p>This consumes the <code>Url</code> and takes ownership of the <code>String</code> stored in it.</p>
</div><h4 id='method.origin' class='method'><code>fn <a href='#method.origin' class='fnname'>origin</a>(&amp;self) -&gt; <a class='enum' href='../url/enum.Origin.html' title='url::Origin'>Origin</a></code></h4>
<div class='docblock'><p>Return the origin of this URL (<a href="https://url.spec.whatwg.org/#origin">https://url.spec.whatwg.org/#origin</a>)</p>
<p>Note: this return an opaque origin for <code>file:</code> URLs, which causes
<code>url.origin() != url.origin()</code>.</p>
<h1 id='examples' class='section-header'><a href='#examples'>Examples</a></h1>
<p>URL with <code>ftp</code> scheme:</p>
<pre class='rust rust-example-rendered'>
<span class='kw'>use</span> <span class='ident'>url</span>::{<span class='ident'>Host</span>, <span class='ident'>Origin</span>, <span class='ident'>Url</span>};
<span class='kw'>let</span> <span class='ident'>url</span> <span class='op'>=</span> <span class='ident'>Url</span>::<span class='ident'>parse</span>(<span class='string'>&quot;ftp://example.com/foo&quot;</span>).<span class='ident'>unwrap</span>();
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>url</span>.<span class='ident'>origin</span>(),
<span class='ident'>Origin</span>::<span class='ident'>Tuple</span>(<span class='string'>&quot;ftp&quot;</span>.<span class='ident'>into</span>(),
<span class='ident'>Host</span>::<span class='ident'>Domain</span>(<span class='string'>&quot;example.com&quot;</span>.<span class='ident'>into</span>()),
<span class='number'>21</span>));</pre>
<p>URL with <code>blob</code> scheme:</p>
<pre class='rust rust-example-rendered'>
<span class='kw'>use</span> <span class='ident'>url</span>::{<span class='ident'>Host</span>, <span class='ident'>Origin</span>, <span class='ident'>Url</span>};
<span class='kw'>let</span> <span class='ident'>url</span> <span class='op'>=</span> <span class='ident'>Url</span>::<span class='ident'>parse</span>(<span class='string'>&quot;blob:https://example.com/foo&quot;</span>).<span class='ident'>unwrap</span>();
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>url</span>.<span class='ident'>origin</span>(),
<span class='ident'>Origin</span>::<span class='ident'>Tuple</span>(<span class='string'>&quot;https&quot;</span>.<span class='ident'>into</span>(),
<span class='ident'>Host</span>::<span class='ident'>Domain</span>(<span class='string'>&quot;example.com&quot;</span>.<span class='ident'>into</span>()),
<span class='number'>443</span>));</pre>
<p>URL with <code>file</code> scheme:</p>
<pre class='rust rust-example-rendered'>
<span class='kw'>use</span> <span class='ident'>url</span>::{<span class='ident'>Host</span>, <span class='ident'>Origin</span>, <span class='ident'>Url</span>};
<span class='kw'>let</span> <span class='ident'>url</span> <span class='op'>=</span> <span class='ident'>Url</span>::<span class='ident'>parse</span>(<span class='string'>&quot;file:///tmp/foo&quot;</span>).<span class='ident'>unwrap</span>();
<span class='macro'>assert</span><span class='macro'>!</span>(<span class='op'>!</span><span class='ident'>url</span>.<span class='ident'>origin</span>().<span class='ident'>is_tuple</span>());
<span class='kw'>let</span> <span class='ident'>other_url</span> <span class='op'>=</span> <span class='ident'>Url</span>::<span class='ident'>parse</span>(<span class='string'>&quot;file:///tmp/foo&quot;</span>).<span class='ident'>unwrap</span>();
<span class='macro'>assert</span><span class='macro'>!</span>(<span class='ident'>url</span>.<span class='ident'>origin</span>() <span class='op'>!=</span> <span class='ident'>other_url</span>.<span class='ident'>origin</span>());</pre>
<p>URL with other scheme:</p>
<pre class='rust rust-example-rendered'>
<span class='kw'>use</span> <span class='ident'>url</span>::{<span class='ident'>Host</span>, <span class='ident'>Origin</span>, <span class='ident'>Url</span>};
<span class='kw'>let</span> <span class='ident'>url</span> <span class='op'>=</span> <span class='ident'>Url</span>::<span class='ident'>parse</span>(<span class='string'>&quot;foo:bar&quot;</span>).<span class='ident'>unwrap</span>();
<span class='macro'>assert</span><span class='macro'>!</span>(<span class='op'>!</span><span class='ident'>url</span>.<span class='ident'>origin</span>().<span class='ident'>is_tuple</span>());</pre>
</div><h4 id='method.scheme' class='method'><code>fn <a href='#method.scheme' class='fnname'>scheme</a>(&amp;self) -&gt; &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>Return the scheme of this URL, lower-cased, as an ASCII string without the &#39;:&#39; delimiter.</p>
</div><h4 id='method.has_authority' class='method'><code>fn <a href='#method.has_authority' class='fnname'>has_authority</a>(&amp;self) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
<div class='docblock'><p>Return whether the URL has an &#39;authority&#39;,
which can contain a username, password, host, and port number.</p>
<p>URLs that do <em>not</em> are either path-only like <code>unix:/run/foo.socket</code>
or cannot-be-a-base like <code>data:text/plain,Stuff</code>.</p>
</div><h4 id='method.cannot_be_a_base' class='method'><code>fn <a href='#method.cannot_be_a_base' class='fnname'>cannot_be_a_base</a>(&amp;self) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
<div class='docblock'><p>Return whether this URL is a cannot-be-a-base URL,
meaning that parsing a relative URL string with this URL as the base will return an error.</p>
<p>This is the case if the scheme and <code>:</code> delimiter are not followed by a <code>/</code> slash,
as is typically the case of <code>data:</code> and <code>mailto:</code> URLs.</p>
</div><h4 id='method.username' class='method'><code>fn <a href='#method.username' class='fnname'>username</a>(&amp;self) -&gt; &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>Return the username for this URL (typically the empty string)
as a percent-encoded ASCII string.</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'>url</span>::<span class='ident'>Url</span>;
<span class='kw'>let</span> <span class='ident'>url</span> <span class='op'>=</span> <span class='ident'>Url</span>::<span class='ident'>parse</span>(<span class='string'>&quot;ftp://rms@example.com&quot;</span>).<span class='ident'>unwrap</span>();
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>url</span>.<span class='ident'>username</span>(), <span class='string'>&quot;rms&quot;</span>);
<span class='kw'>let</span> <span class='ident'>url</span> <span class='op'>=</span> <span class='ident'>Url</span>::<span class='ident'>parse</span>(<span class='string'>&quot;https://example.com&quot;</span>).<span class='ident'>unwrap</span>();
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>url</span>.<span class='ident'>username</span>(), <span class='string'>&quot;&quot;</span>);</pre>
</div><h4 id='method.password' class='method'><code>fn <a href='#method.password' class='fnname'>password</a>(&amp;self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;</code></h4>
<div class='docblock'><p>Return the password for this URL, if any, as a percent-encoded ASCII string.</p>
</div><h4 id='method.has_host' class='method'><code>fn <a href='#method.has_host' class='fnname'>has_host</a>(&amp;self) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
<div class='docblock'><p>Equivalent to <code>url.host().is_some()</code>.</p>
</div><h4 id='method.host_str' class='method'><code>fn <a href='#method.host_str' class='fnname'>host_str</a>(&amp;self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;</code></h4>
<div class='docblock'><p>Return the string representation of the host (domain or IP address) for this URL, if any.</p>
<p>Non-ASCII domains are punycode-encoded per IDNA.
IPv6 addresses are given between <code>[</code> and <code>]</code> brackets.</p>
<p>Cannot-be-a-base URLs (typical of <code>data:</code> and <code>mailto:</code>) and some <code>file:</code> URLs
dont have a host.</p>
<p>See also the <code>host</code> method.</p>
</div><h4 id='method.host' class='method'><code>fn <a href='#method.host' class='fnname'>host</a>(&amp;self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='enum' href='../url/enum.Host.html' title='url::Host'>Host</a>&lt;&amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;&gt;</code></h4>
<div class='docblock'><p>Return the parsed representation of the host for this URL.
Non-ASCII domain labels are punycode-encoded per IDNA.</p>
<p>Cannot-be-a-base URLs (typical of <code>data:</code> and <code>mailto:</code>) and some <code>file:</code> URLs
dont have a host.</p>
<p>See also the <code>host_str</code> method.</p>
</div><h4 id='method.domain' class='method'><code>fn <a href='#method.domain' class='fnname'>domain</a>(&amp;self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;</code></h4>
<div class='docblock'><p>If this URL has a host and it is a domain name (not an IP address), return it.</p>
</div><h4 id='method.port' class='method'><code>fn <a href='#method.port' class='fnname'>port</a>(&amp;self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u16.html'>u16</a>&gt;</code></h4>
<div class='docblock'><p>Return the port number for this URL, if any.</p>
</div><h4 id='method.port_or_known_default' class='method'><code>fn <a href='#method.port_or_known_default' class='fnname'>port_or_known_default</a>(&amp;self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u16.html'>u16</a>&gt;</code></h4>
<div class='docblock'><p>Return the port number for this URL, or the default port number if it is known.</p>
<p>This method only knows the default port number
of the <code>http</code>, <code>https</code>, <code>ws</code>, <code>wss</code>, <code>ftp</code>, and <code>gopher</code> schemes.</p>
<p>For URLs in these schemes, this method always returns <code>Some(_)</code>.
For other schemes, it is the same as <code>Url::port()</code>.</p>
</div><h4 id='method.with_default_port' class='method'><code>fn <a href='#method.with_default_port' class='fnname'>with_default_port</a>&lt;F&gt;(&amp;self, f: F) -&gt; <a class='type' href='https://doc.rust-lang.org/nightly/std/io/error/type.Result.html' title='std::io::error::Result'>Result</a>&lt;<a class='struct' href='../url/struct.HostAndPort.html' title='url::HostAndPort'>HostAndPort</a>&lt;&amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;&gt; <span class='where'>where F: <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.FnOnce.html' title='core::ops::FnOnce'>FnOnce</a>(&amp;<a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a>) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u16.html'>u16</a>,&nbsp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</span></code></h4>
<div class='docblock'><p>If the URL has a host, return something that implements <code>ToSocketAddrs</code>.</p>
<p>If the URL has no port number and the schemes default port number is not known
(see <code>Url::port_or_known_default</code>),
the closure is called to obtain a port number.
Typically, this closure can match on the result <code>Url::scheme</code>
to have per-scheme default port numbers,
and panic for schemes its not prepared to handle.
For example:</p>
<pre class='rust rust-example-rendered'>
<span class='kw'>fn</span> <span class='ident'>connect</span>(<span class='ident'>url</span>: <span class='kw-2'>&amp;</span><span class='ident'>Url</span>) <span class='op'>-&gt;</span> <span class='ident'>io</span>::<span class='prelude-ty'>Result</span><span class='op'>&lt;</span><span class='ident'>TcpStream</span><span class='op'>&gt;</span> {
<span class='ident'>TcpStream</span>::<span class='ident'>connect</span>(<span class='macro'>try</span><span class='macro'>!</span>(<span class='ident'>url</span>.<span class='ident'>with_default_port</span>(<span class='ident'>default_port</span>)))
}
<span class='kw'>fn</span> <span class='ident'>default_port</span>(<span class='ident'>url</span>: <span class='kw-2'>&amp;</span><span class='ident'>Url</span>) <span class='op'>-&gt;</span> <span class='prelude-ty'>Result</span><span class='op'>&lt;</span><span class='ident'>u16</span>, ()<span class='op'>&gt;</span> {
<span class='kw'>match</span> <span class='ident'>url</span>.<span class='ident'>scheme</span>() {
<span class='string'>&quot;git&quot;</span> <span class='op'>=&gt;</span> <span class='prelude-val'>Ok</span>(<span class='number'>9418</span>),
<span class='string'>&quot;git+ssh&quot;</span> <span class='op'>=&gt;</span> <span class='prelude-val'>Ok</span>(<span class='number'>22</span>),
<span class='string'>&quot;git+https&quot;</span> <span class='op'>=&gt;</span> <span class='prelude-val'>Ok</span>(<span class='number'>443</span>),
<span class='string'>&quot;git+http&quot;</span> <span class='op'>=&gt;</span> <span class='prelude-val'>Ok</span>(<span class='number'>80</span>),
_ <span class='op'>=&gt;</span> <span class='prelude-val'>Err</span>(()),
}
}</pre>
</div><h4 id='method.path' class='method'><code>fn <a href='#method.path' class='fnname'>path</a>(&amp;self) -&gt; &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>Return the path for this URL, as a percent-encoded ASCII string.
For cannot-be-a-base URLs, this is an arbitrary string that doesnt start with &#39;/&#39;.
For other URLs, this starts with a &#39;/&#39; slash
and continues with slash-separated path segments.</p>
</div><h4 id='method.path_segments' class='method'><code>fn <a href='#method.path_segments' class='fnname'>path_segments</a>(&amp;self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/core/str/struct.Split.html' title='core::str::Split'>Split</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.char.html'>char</a>&gt;&gt;</code></h4>
<div class='docblock'><p>Unless this URL is cannot-be-a-base,
return an iterator of &#39;/&#39; slash-separated path segments,
each as a percent-encoded ASCII string.</p>
<p>Return <code>None</code> for cannot-be-a-base URLs.</p>
<p>When <code>Some</code> is returned, the iterator always contains at least one string
(which may be empty).</p>
</div><h4 id='method.query' class='method'><code>fn <a href='#method.query' class='fnname'>query</a>(&amp;self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;</code></h4>
<div class='docblock'><p>Return this URLs query string, if any, as a percent-encoded ASCII string.</p>
</div><h4 id='method.query_pairs' class='method'><code>fn <a href='#method.query_pairs' class='fnname'>query_pairs</a>(&amp;self) -&gt; <a class='struct' href='../url/form_urlencoded/struct.Parse.html' title='url::form_urlencoded::Parse'>Parse</a></code></h4>
<div class='docblock'><p>Parse the URLs query string, if any, as <code>application/x-www-form-urlencoded</code>
and return an iterator of (key, value) pairs.</p>
</div><h4 id='method.fragment' class='method'><code>fn <a href='#method.fragment' class='fnname'>fragment</a>(&amp;self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;</code></h4>
<div class='docblock'><p>Return this URLs fragment identifier, if any.</p>
<p><strong>Note:</strong> the parser did <em>not</em> percent-encode this component,
but the input may have been percent-encoded already.</p>
</div><h4 id='method.set_fragment' class='method'><code>fn <a href='#method.set_fragment' class='fnname'>set_fragment</a>(&amp;mut self, fragment: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;)</code></h4>
<div class='docblock'><p>Change this URLs fragment identifier.</p>
</div><h4 id='method.set_query' class='method'><code>fn <a href='#method.set_query' class='fnname'>set_query</a>(&amp;mut self, query: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;)</code></h4>
<div class='docblock'><p>Change this URLs query string.</p>
</div><h4 id='method.query_pairs_mut' class='method'><code>fn <a href='#method.query_pairs_mut' class='fnname'>query_pairs_mut</a>(&amp;mut self) -&gt; <a class='struct' href='../url/form_urlencoded/struct.Serializer.html' title='url::form_urlencoded::Serializer'>Serializer</a>&lt;<a class='struct' href='../url/struct.UrlQuery.html' title='url::UrlQuery'>UrlQuery</a>&gt;</code></h4>
<div class='docblock'><p>Manipulate this URLs query string, viewed as a sequence of name/value pairs
in <code>application/x-www-form-urlencoded</code> syntax.</p>
<p>The return value has a method-chaining API:</p>
<pre class='rust rust-example-rendered'>
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>url</span> <span class='op'>=</span> <span class='ident'>Url</span>::<span class='ident'>parse</span>(<span class='string'>&quot;https://example.net?lang=fr#nav&quot;</span>).<span class='ident'>unwrap</span>();
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>url</span>.<span class='ident'>query</span>(), <span class='prelude-val'>Some</span>(<span class='string'>&quot;lang=fr&quot;</span>));
<span class='ident'>url</span>.<span class='ident'>query_pairs_mut</span>().<span class='ident'>append_pair</span>(<span class='string'>&quot;foo&quot;</span>, <span class='string'>&quot;bar&quot;</span>);
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>url</span>.<span class='ident'>query</span>(), <span class='prelude-val'>Some</span>(<span class='string'>&quot;lang=fr&amp;foo=bar&quot;</span>));
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>url</span>.<span class='ident'>as_str</span>(), <span class='string'>&quot;https://example.net/?lang=fr&amp;foo=bar#nav&quot;</span>);
<span class='ident'>url</span>.<span class='ident'>query_pairs_mut</span>()
.<span class='ident'>clear</span>()
.<span class='ident'>append_pair</span>(<span class='string'>&quot;foo&quot;</span>, <span class='string'>&quot;bar &amp; baz&quot;</span>)
.<span class='ident'>append_pair</span>(<span class='string'>&quot;saisons&quot;</span>, <span class='string'>&quot;Été+hiver&quot;</span>);
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>url</span>.<span class='ident'>query</span>(), <span class='prelude-val'>Some</span>(<span class='string'>&quot;foo=bar+%26+baz&amp;saisons=%C3%89t%C3%A9%2Bhiver&quot;</span>));
<span class='macro'>assert_eq</span><span class='macro'>!</span>(<span class='ident'>url</span>.<span class='ident'>as_str</span>(),
<span class='string'>&quot;https://example.net/?foo=bar+%26+baz&amp;saisons=%C3%89t%C3%A9%2Bhiver#nav&quot;</span>);</pre>
<p>Note: <code>url.query_pairs_mut().clear();</code> is equivalent to <code>url.set_query(Some(&quot;&quot;))</code>,
not <code>url.set_query(None)</code>.</p>
<p>The state of <code>Url</code> is unspecified if this return value is leaked without being dropped.</p>
</div><h4 id='method.set_path' class='method'><code>fn <a href='#method.set_path' class='fnname'>set_path</a>(&amp;mut self, path: &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>)</code></h4>
<div class='docblock'><p>Change this URLs path.</p>
</div><h4 id='method.path_segments_mut' class='method'><code>fn <a href='#method.path_segments_mut' class='fnname'>path_segments_mut</a>(&amp;mut self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='struct' href='../url/struct.PathSegmentsMut.html' title='url::PathSegmentsMut'>PathSegmentsMut</a>,&nbsp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h4>
<div class='docblock'><p>Return an object with methods to manipulate this URLs path segments.</p>
<p>Return <code>Err(())</code> if this URl is cannot-be-a-base.</p>
</div><h4 id='method.set_port' class='method'><code>fn <a href='#method.set_port' class='fnname'>set_port</a>(&amp;mut self, port: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.u16.html'>u16</a>&gt;) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>,&nbsp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h4>
<div class='docblock'><p>Change this URLs port number.</p>
<p>If this URL is cannot-be-a-base, does not have a host, or has the <code>file</code> scheme;
do nothing and return <code>Err</code>.</p>
</div><h4 id='method.set_host' class='method'><code>fn <a href='#method.set_host' class='fnname'>set_host</a>(&amp;mut self, host: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>,&nbsp;<a class='enum' href='../url/enum.ParseError.html' title='url::ParseError'>ParseError</a>&gt;</code></h4>
<div class='docblock'><p>Change this URLs host.</p>
<p>If this URL is cannot-be-a-base or there is an error parsing the given <code>host</code>,
do nothing and return <code>Err</code>.</p>
<p>Removing the host (calling this with <code>None</code>)
will also remove any username, password, and port number.</p>
</div><h4 id='method.set_ip_host' class='method'><code>fn <a href='#method.set_ip_host' class='fnname'>set_ip_host</a>(&amp;mut self, address: <a class='enum' href='https://doc.rust-lang.org/nightly/std/net/ip/enum.IpAddr.html' title='std::net::ip::IpAddr'>IpAddr</a>) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>,&nbsp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h4>
<div class='docblock'><p>Change this URLs host to the given IP address.</p>
<p>If this URL is cannot-be-a-base, do nothing and return <code>Err</code>.</p>
<p>Compared to <code>Url::set_host</code>, this skips the host parser.</p>
</div><h4 id='method.set_password' class='method'><code>fn <a href='#method.set_password' class='fnname'>set_password</a>(&amp;mut self, password: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt;) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>,&nbsp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h4>
<div class='docblock'><p>Change this URLs password.</p>
<p>If this URL is cannot-be-a-base or does not have a host, do nothing and return <code>Err</code>.</p>
</div><h4 id='method.set_username' class='method'><code>fn <a href='#method.set_username' class='fnname'>set_username</a>(&amp;mut self, username: &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>,&nbsp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h4>
<div class='docblock'><p>Change this URLs username.</p>
<p>If this URL is cannot-be-a-base or does not have a host, do nothing and return <code>Err</code>.</p>
</div><h4 id='method.set_scheme' class='method'><code>fn <a href='#method.set_scheme' class='fnname'>set_scheme</a>(&amp;mut self, scheme: &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>,&nbsp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h4>
<div class='docblock'><p>Change this URLs scheme.</p>
<p>Do nothing and return <code>Err</code> if:
* The new scheme is not in <code>[a-zA-Z][a-zA-Z0-9+.-]+</code>
* This URL is cannot-be-a-base and the new scheme is one of
<code>http</code>, <code>https</code>, <code>ws</code>, <code>wss</code>, <code>ftp</code>, or <code>gopher</code></p>
</div><h4 id='method.from_file_path' class='method'><code>fn <a href='#method.from_file_path' class='fnname'>from_file_path</a>&lt;P:&nbsp;<a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/std/path/struct.Path.html' title='std::path::Path'>Path</a>&gt;&gt;(path: P) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a>,&nbsp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h4>
<div class='docblock'><p>Convert a file name as <code>std::path::Path</code> into an URL in the <code>file</code> scheme.</p>
<p>This returns <code>Err</code> if the given path is not absolute or,
on Windows, if the prefix is not a disk prefix (e.g. <code>C:</code>).</p>
</div><h4 id='method.from_directory_path' class='method'><code>fn <a href='#method.from_directory_path' class='fnname'>from_directory_path</a>&lt;P:&nbsp;<a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/std/path/struct.Path.html' title='std::path::Path'>Path</a>&gt;&gt;(path: P) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a>,&nbsp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h4>
<div class='docblock'><p>Convert a directory name as <code>std::path::Path</code> into an URL in the <code>file</code> scheme.</p>
<p>This returns <code>Err</code> if the given path is not absolute or,
on Windows, if the prefix is not a disk prefix (e.g. <code>C:</code>).</p>
<p>Compared to <code>from_file_path</code>, this ensure that URLs the path has a trailing slash
so that the entire path is considered when using this URL as a base URL.</p>
<p>For example:</p>
<ul>
<li><code>&quot;index.html&quot;</code> parsed with <code>Url::from_directory_path(Path::new(&quot;/var/www&quot;))</code>
as the base URL is <code>file:///var/www/index.html</code></li>
<li><code>&quot;index.html&quot;</code> parsed with <code>Url::from_file_path(Path::new(&quot;/var/www&quot;))</code>
as the base URL is <code>file:///var/index.html</code>, which might not be what was intended.</li>
</ul>
<p>Note that <code>std::path</code> does not consider trailing slashes significant
and usually does not include them (e.g. in <code>Path::parent()</code>).</p>
</div><h4 id='method.to_file_path' class='method'><code>fn <a href='#method.to_file_path' class='fnname'>to_file_path</a>(&amp;self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html' title='std::path::PathBuf'>PathBuf</a>,&nbsp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h4>
<div class='docblock'><p>Assuming the URL is in the <code>file</code> scheme or similar,
convert its path to an absolute <code>std::path::Path</code>.</p>
<p><strong>Note:</strong> This does not actually check the URLs <code>scheme</code>,
and may give nonsensical results for other schemes.
It is the users responsibility to check the URLs scheme before calling this.</p>
<pre class='rust rust-example-rendered'>
<span class='kw'>let</span> <span class='ident'>path</span> <span class='op'>=</span> <span class='ident'>url</span>.<span class='ident'>to_file_path</span>();</pre>
<p>Returns <code>Err</code> if the host is neither empty nor <code>&quot;localhost&quot;</code>,
or if <code>Path::new_opt()</code> returns <code>None</code>.
(That is, if the percent-decoded path contains a NUL byte or,
for a Windows path, is not UTF-8.)</p>
</div></div><h2 id='implementations'>Trait Implementations</h2><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html' title='core::ops::Index'>Index</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/core/ops/struct.RangeFull.html' title='core::ops::RangeFull'>RangeFull</a>&gt; for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1166' class='srclink' href='../src/url/slicing.rs.html#12-17' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Output' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html#associatedtype.Output' class='type'>Output</a> = <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>The returned type after indexing</p>
</div><h4 id='method.index' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html#tymethod.index' class='fnname'>index</a>(&amp;self, _: <a class='struct' href='https://doc.rust-lang.org/nightly/core/ops/struct.RangeFull.html' title='core::ops::RangeFull'>RangeFull</a>) -&gt; &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>The method for the indexing (<code>Foo[Bar]</code>) operation</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html' title='core::ops::Index'>Index</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/core/ops/struct.RangeFrom.html' title='core::ops::RangeFrom'>RangeFrom</a>&lt;<a class='enum' href='../url/enum.Position.html' title='url::Position'>Position</a>&gt;&gt; for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1170' class='srclink' href='../src/url/slicing.rs.html#19-24' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Output-1' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html#associatedtype.Output' class='type'>Output</a> = <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>The returned type after indexing</p>
</div><h4 id='method.index-1' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html#tymethod.index' class='fnname'>index</a>(&amp;self, range: <a class='struct' href='https://doc.rust-lang.org/nightly/core/ops/struct.RangeFrom.html' title='core::ops::RangeFrom'>RangeFrom</a>&lt;<a class='enum' href='../url/enum.Position.html' title='url::Position'>Position</a>&gt;) -&gt; &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>The method for the indexing (<code>Foo[Bar]</code>) operation</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html' title='core::ops::Index'>Index</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/core/ops/struct.RangeTo.html' title='core::ops::RangeTo'>RangeTo</a>&lt;<a class='enum' href='../url/enum.Position.html' title='url::Position'>Position</a>&gt;&gt; for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1175' class='srclink' href='../src/url/slicing.rs.html#26-31' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Output-2' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html#associatedtype.Output' class='type'>Output</a> = <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>The returned type after indexing</p>
</div><h4 id='method.index-2' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html#tymethod.index' class='fnname'>index</a>(&amp;self, range: <a class='struct' href='https://doc.rust-lang.org/nightly/core/ops/struct.RangeTo.html' title='core::ops::RangeTo'>RangeTo</a>&lt;<a class='enum' href='../url/enum.Position.html' title='url::Position'>Position</a>&gt;) -&gt; &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>The method for the indexing (<code>Foo[Bar]</code>) operation</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html' title='core::ops::Index'>Index</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/core/ops/struct.Range.html' title='core::ops::Range'>Range</a>&lt;<a class='enum' href='../url/enum.Position.html' title='url::Position'>Position</a>&gt;&gt; for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1180' class='srclink' href='../src/url/slicing.rs.html#33-38' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='associatedtype.Output-3' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html#associatedtype.Output' class='type'>Output</a> = <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>The returned type after indexing</p>
</div><h4 id='method.index-3' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/ops/trait.Index.html#tymethod.index' class='fnname'>index</a>(&amp;self, range: <a class='struct' href='https://doc.rust-lang.org/nightly/core/ops/struct.Range.html' title='core::ops::Range'>Range</a>&lt;<a class='enum' href='../url/enum.Position.html' title='url::Position'>Position</a>&gt;) -&gt; &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>The method for the indexing (<code>Foo[Bar]</code>) operation</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html' title='core::clone::Clone'>Clone</a> for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1672' class='srclink' href='../src/url/lib.rs.html#156' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.clone' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></h4>
<div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: &amp;Self)</code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></h4>
<div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/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='https://doc.rust-lang.org/nightly/std/net/addr/trait.ToSocketAddrs.html' title='std::net::addr::ToSocketAddrs'>ToSocketAddrs</a> for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-2313' class='srclink' href='../src/url/lib.rs.html#1160-1166' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>Return an error if <code>Url::host</code> or <code>Url::port_or_known_default</code> return <code>None</code>.</p>
</div><div class='impl-items'><h4 id='associatedtype.Iter' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/std/net/addr/trait.ToSocketAddrs.html#associatedtype.Iter' class='type'>Iter</a> = <a class='struct' href='../url/struct.SocketAddrs.html' title='url::SocketAddrs'>SocketAddrs</a></code></h4>
<div class='docblock'><p>Returned iterator over socket addresses which this type may correspond to. <a href="https://doc.rust-lang.org/nightly/std/net/addr/trait.ToSocketAddrs.html#associatedtype.Iter">Read more</a></p>
</div><h4 id='method.to_socket_addrs' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/std/net/addr/trait.ToSocketAddrs.html#tymethod.to_socket_addrs' class='fnname'>to_socket_addrs</a>(&amp;self) -&gt; <a class='type' href='https://doc.rust-lang.org/nightly/std/io/error/type.Result.html' title='std::io::error::Result'>Result</a>&lt;Self::<a class='trait' href='https://doc.rust-lang.org/nightly/std/net/addr/trait.ToSocketAddrs.html' title='std::net::addr::ToSocketAddrs'>Iter</a>&gt;</code></h4>
<div class='docblock'><p>Converts this object to an iterator of resolved <code>SocketAddr</code>s. <a href="https://doc.rust-lang.org/nightly/std/net/addr/trait.ToSocketAddrs.html#tymethod.to_socket_addrs">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html' title='core::str::FromStr'>FromStr</a> for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-2320' class='srclink' href='../src/url/lib.rs.html#1169-1176' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>Parse a string as an URL, without a base URL or encoding override.</p>
</div><div class='impl-items'><h4 id='associatedtype.Err' class='type'><code>type <a href='https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html#associatedtype.Err' class='type'>Err</a> = <a class='enum' href='../url/enum.ParseError.html' title='url::ParseError'>ParseError</a></code></h4>
<div class='docblock'><p>The associated error which can be returned from parsing.</p>
</div><h4 id='method.from_str' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html#tymethod.from_str' class='fnname'>from_str</a>(input: &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a>,&nbsp;<a class='enum' href='../url/enum.ParseError.html' title='url::ParseError'>ParseError</a>&gt;</code></h4>
<div class='docblock'><p>Parses a string <code>s</code> to return a value of this type. <a href="https://doc.rust-lang.org/nightly/core/str/trait.FromStr.html#tymethod.from_str">Read more</a></p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html' title='core::fmt::Display'>Display</a> for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-2324' class='srclink' href='../src/url/lib.rs.html#1179-1184' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>Display the serialization of this URL.</p>
</div><div class='impl-items'><h4 id='method.fmt' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, formatter: &amp;mut <a class='struct' href='https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html' title='core::fmt::Formatter'>Formatter</a>) -&gt; <a class='type' href='https://doc.rust-lang.org/nightly/core/fmt/type.Result.html' title='core::fmt::Result'>Result</a></code></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='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-2328' class='srclink' href='../src/url/lib.rs.html#1187-1192' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>Debug the serialization of this URL.</p>
</div><div class='impl-items'><h4 id='method.fmt-1' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, formatter: &amp;mut <a class='struct' href='https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html' title='core::fmt::Formatter'>Formatter</a>) -&gt; <a class='type' href='https://doc.rust-lang.org/nightly/core/fmt/type.Result.html' title='core::fmt::Result'>Result</a></code></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='https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html' title='core::cmp::Eq'>Eq</a> for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-2332' class='srclink' href='../src/url/lib.rs.html#1195' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>URLs compare like their serialization.</p>
</div><div class='impl-items'></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html' title='core::cmp::PartialEq'>PartialEq</a> for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-2333' class='srclink' href='../src/url/lib.rs.html#1198-1203' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>URLs compare like their serialization.</p>
</div><div class='impl-items'><h4 id='method.eq' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq' class='fnname'>eq</a>(&amp;self, other: &amp;Self) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></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="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
</div><h4 id='method.ne' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne' class='fnname'>ne</a>(&amp;self, other: &amp;Rhs) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></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='https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html' title='core::cmp::Ord'>Ord</a> for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-2337' class='srclink' href='../src/url/lib.rs.html#1206-1211' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>URLs compare like their serialization.</p>
</div><div class='impl-items'><h4 id='method.cmp' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp' class='fnname'>cmp</a>(&amp;self, other: &amp;Self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html' title='core::cmp::Ordering'>Ordering</a></code></h4>
<div class='docblock'><p>This method returns an <code>Ordering</code> between <code>self</code> and <code>other</code>. <a href="https://doc.rust-lang.org/nightly/core/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='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html' title='core::cmp::PartialOrd'>PartialOrd</a> for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-2341' class='srclink' href='../src/url/lib.rs.html#1214-1219' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>URLs compare like their serialization.</p>
</div><div class='impl-items'><h4 id='method.partial_cmp' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp' class='fnname'>partial_cmp</a>(&amp;self, other: &amp;Self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='enum' href='https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html' title='core::cmp::Ordering'>Ordering</a>&gt;</code></h4>
<div class='docblock'><p>This method returns an ordering between <code>self</code> and <code>other</code> values if one exists. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#tymethod.partial_cmp">Read more</a></p>
</div><h4 id='method.lt' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt' class='fnname'>lt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></h4>
<div class='docblock'><p>This method tests less than (for <code>self</code> and <code>other</code>) and is used by the <code>&lt;</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt">Read more</a></p>
</div><h4 id='method.le' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le' class='fnname'>le</a>(&amp;self, other: &amp;Rhs) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></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>&lt;=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le">Read more</a></p>
</div><h4 id='method.gt' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt' class='fnname'>gt</a>(&amp;self, other: &amp;Rhs) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></h4>
<div class='docblock'><p>This method tests greater than (for <code>self</code> and <code>other</code>) and is used by the <code>&gt;</code> operator. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt">Read more</a></p>
</div><h4 id='method.ge' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge' class='fnname'>ge</a>(&amp;self, other: &amp;Rhs) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code><div class='since' title='Stable since Rust version 1.0.0'>1.0.0</div></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>&gt;=</code> operator. <a href="https://doc.rust-lang.org/nightly/core/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='https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html' title='core::hash::Hash'>Hash</a> for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-2345' class='srclink' href='../src/url/lib.rs.html#1222-1227' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>URLs hash like their serialization.</p>
</div><div class='impl-items'><h4 id='method.hash' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash' class='fnname'>hash</a>&lt;H&gt;(&amp;self, state: &amp;mut H) <span class='where'>where H: <a class='trait' href='https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html' title='core::hash::Hasher'>Hasher</a></span></code></h4>
<div class='docblock'><p>Feeds this value into the state given, updating the hasher as necessary.</p>
</div><h4 id='method.hash_slice' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice' class='fnname'>hash_slice</a>&lt;H&gt;(data: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.slice.html'>&amp;[Self]</a>, state: &amp;mut H) <span class='where'>where H: <a class='trait' href='https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html' title='core::hash::Hasher'>Hasher</a></span></code><div class='since' title='Stable since Rust version 1.3.0'>1.3.0</div></h4>
<div class='docblock'><p>Feeds a slice of this type into the state provided.</p>
</div></div><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html' title='core::convert::AsRef'>AsRef</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a>&gt; for <a class='struct' href='../url/struct.Url.html' title='url::Url'>Url</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-2350' class='srclink' href='../src/url/lib.rs.html#1230-1235' title='goto source code'>[src]</a></span></h3>
<div class='docblock'><p>Return the serialization of this URL.</p>
</div><div class='impl-items'><h4 id='method.as_ref' class='method'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html#tymethod.as_ref' class='fnname'>as_ref</a>(&amp;self) -&gt; &amp;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.str.html'>str</a></code></h4>
<div class='docblock'><p>Performs the conversion.</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>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</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 = "url";
window.playgroundUrl = "";
</script>
<script src="../jquery.js"></script>
<script src="../main.js"></script>
<script defer src="../search-index.js"></script>
</body>
</html>