blob: f27ef42dd7a464f6520cac9a05f02c46a9063c2b [file] [log] [blame]
<!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="A parsed URL record."><meta name="keywords" content="rust, rustlang, rust-lang, Url"><title>Url in reqwest - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../SourceCodePro-Semibold.ttf.woff2"><link rel="stylesheet" href="../normalize.css"><link rel="stylesheet" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" href="../ayu.css" disabled><link rel="stylesheet" href="../dark.css" disabled><link rel="stylesheet" href="../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../storage.js"></script><script defer src="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../reqwest/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../reqwest/index.html"><div class="logo-container"><img class="rust-logo" src="../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Url</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.as_str">as_str</a></li><li><a href="#method.cannot_be_a_base">cannot_be_a_base</a></li><li><a href="#method.deserialize_internal">deserialize_internal</a></li><li><a href="#method.domain">domain</a></li><li><a href="#method.fragment">fragment</a></li><li><a href="#method.from_directory_path">from_directory_path</a></li><li><a href="#method.from_file_path">from_file_path</a></li><li><a href="#method.has_authority">has_authority</a></li><li><a href="#method.has_host">has_host</a></li><li><a href="#method.host">host</a></li><li><a href="#method.host_str">host_str</a></li><li><a href="#method.into_string">into_string</a></li><li><a href="#method.join">join</a></li><li><a href="#method.make_relative">make_relative</a></li><li><a href="#method.options">options</a></li><li><a href="#method.origin">origin</a></li><li><a href="#method.parse">parse</a></li><li><a href="#method.parse_with_params">parse_with_params</a></li><li><a href="#method.password">password</a></li><li><a href="#method.path">path</a></li><li><a href="#method.path_segments">path_segments</a></li><li><a href="#method.path_segments_mut">path_segments_mut</a></li><li><a href="#method.port">port</a></li><li><a href="#method.port_or_known_default">port_or_known_default</a></li><li><a href="#method.query">query</a></li><li><a href="#method.query_pairs">query_pairs</a></li><li><a href="#method.query_pairs_mut">query_pairs_mut</a></li><li><a href="#method.scheme">scheme</a></li><li><a href="#method.serialize_internal">serialize_internal</a></li><li><a href="#method.set_fragment">set_fragment</a></li><li><a href="#method.set_host">set_host</a></li><li><a href="#method.set_ip_host">set_ip_host</a></li><li><a href="#method.set_password">set_password</a></li><li><a href="#method.set_path">set_path</a></li><li><a href="#method.set_port">set_port</a></li><li><a href="#method.set_query">set_query</a></li><li><a href="#method.set_scheme">set_scheme</a></li><li><a href="#method.set_username">set_username</a></li><li><a href="#method.socket_addrs">socket_addrs</a></li><li><a href="#method.to_file_path">to_file_path</a></li><li><a href="#method.username">username</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-AsRef%3Cstr%3E-for-Url">AsRef&lt;str&gt;</a></li><li><a href="#impl-Clone-for-Url">Clone</a></li><li><a href="#impl-Debug-for-Url">Debug</a></li><li><a href="#impl-Deserialize%3C%27de%3E-for-Url">Deserialize&lt;&#39;de&gt;</a></li><li><a href="#impl-Display-for-Url">Display</a></li><li><a href="#impl-Eq-for-Url">Eq</a></li><li><a href="#impl-FromStr-for-Url">FromStr</a></li><li><a href="#impl-Hash-for-Url">Hash</a></li><li><a href="#impl-Index%3CRange%3CPosition%3E%3E-for-Url">Index&lt;Range&lt;Position&gt;&gt;</a></li><li><a href="#impl-Index%3CRangeFrom%3CPosition%3E%3E-for-Url">Index&lt;RangeFrom&lt;Position&gt;&gt;</a></li><li><a href="#impl-Index%3CRangeFull%3E-for-Url">Index&lt;RangeFull&gt;</a></li><li><a href="#impl-Index%3CRangeTo%3CPosition%3E%3E-for-Url">Index&lt;RangeTo&lt;Position&gt;&gt;</a></li><li><a href="#impl-IntoUrl-for-Url">IntoUrl</a></li><li><a href="#impl-Ord-for-Url">Ord</a></li><li><a href="#impl-PartialEq%3CUrl%3E-for-Url">PartialEq&lt;Url&gt;</a></li><li><a href="#impl-PartialOrd%3CUrl%3E-for-Url">PartialOrd&lt;Url&gt;</a></li><li><a href="#impl-Serialize-for-Url">Serialize</a></li><li><a href="#impl-TryFrom%3C%26%27a%20str%3E-for-Url">TryFrom&lt;&amp;&#39;a str&gt;</a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-Url">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Url">Send</a></li><li><a href="#impl-Sync-for-Url">Sync</a></li><li><a href="#impl-Unpin-for-Url">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Url">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-Url">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-Url">Borrow&lt;T&gt;</a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Url">BorrowMut&lt;T&gt;</a></li><li><a href="#impl-DeserializeOwned-for-Url">DeserializeOwned</a></li><li><a href="#impl-Equivalent%3CK%3E-for-Url">Equivalent&lt;K&gt;</a></li><li><a href="#impl-From%3CT%3E-for-Url">From&lt;T&gt;</a></li><li><a href="#impl-Instrument-for-Url">Instrument</a></li><li><a href="#impl-Into%3CU%3E-for-Url">Into&lt;U&gt;</a></li><li><a href="#impl-ToOwned-for-Url">ToOwned</a></li><li><a href="#impl-ToString-for-Url">ToString</a></li><li><a href="#impl-TryFrom%3CU%3E-for-Url">TryFrom&lt;U&gt;</a></li><li><a href="#impl-TryInto%3CU%3E-for-Url">TryInto&lt;U&gt;</a></li><li><a href="#impl-WithSubscriber-for-Url">WithSubscriber</a></li></ul></section><h2><a href="index.html">In reqwest</a></h2></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../wheel.svg"></a></div></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1 class="fqn">Struct <a href="index.html">reqwest</a>::<wbr><a class="struct" href="#">Url</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../src/url/lib.rs.html#170">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct Url { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A parsed URL record.</p>
</div></details><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><div id="implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#256">source</a><a href="#impl-Url" class="anchor"></a><h3 class="code-header">impl <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.parse" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#279">source</a><h4 class="code-header">pub 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="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>, <a class="enum" href="../url/parser/enum.ParseError.html" title="enum url::parser::ParseError">ParseError</a>&gt;</h4></section></summary><div class="docblock"><p>Parse an absolute URL from a string.</p>
<h5 id="examples"><a href="#examples">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.net&quot;</span>)<span class="question-mark">?</span>;</code></pre></div>
<h5 id="errors"><a href="#errors">Errors</a></h5>
<p>If the function can not parse an absolute URL from the given string,
a <a href="enum.ParseError.html"><code>ParseError</code></a> variant will be returned.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.parse_with_params" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#309-314">source</a><h4 class="code-header">pub fn <a href="#method.parse_with_params" class="fnname">parse_with_params</a>&lt;I, K, V&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;input: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;iter: I<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>, <a class="enum" href="../url/parser/enum.ParseError.html" title="enum url::parser::ParseError">ParseError</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;I: <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;I as <a class="trait" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html" title="trait core::iter::traits::collect::IntoIterator">IntoIterator</a>&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#associatedtype.Item" title="type core::iter::traits::collect::IntoIterator::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(K, V)</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;V: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;,</span></h4></section></summary><div class="docblock"><p>Parse an absolute URL from a string and add params to its query string.</p>
<p>Existing params are not removed.</p>
<h5 id="examples-1"><a href="#examples-1">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse_with_params(<span class="string">&quot;https://example.net?dont=clobberme&quot;</span>,
<span class="kw-2">&amp;</span>[(<span class="string">&quot;lang&quot;</span>, <span class="string">&quot;rust&quot;</span>), (<span class="string">&quot;browser&quot;</span>, <span class="string">&quot;servo&quot;</span>)])<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(<span class="string">&quot;https://example.net/?dont=clobberme&amp;lang=rust&amp;browser=servo&quot;</span>, url.as_str());</code></pre></div>
<h5 id="errors-1"><a href="#errors-1">Errors</a></h5>
<p>If the function can not parse an absolute URL from the given string,
a <a href="enum.ParseError.html"><code>ParseError</code></a> variant will be returned.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.join" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#360">source</a><h4 class="code-header">pub 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="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>, <a class="enum" href="../url/parser/enum.ParseError.html" title="enum url::parser::ParseError">ParseError</a>&gt;</h4></section></summary><div class="docblock"><p>Parse a string as an URL, with this URL as the base URL.</p>
<p>The inverse of this is <a href="#method.make_relative"><code>make_relative</code></a>.</p>
<p>Note: a trailing slash is significant.
Without it, the last path component is considered to be a “file” name
to be removed to get at the “directory” that is used as the base:</p>
<h5 id="examples-2"><a href="#examples-2">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>base = Url::parse(<span class="string">&quot;https://example.net/a/b.html&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>url = base.join(<span class="string">&quot;c.png&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.net/a/c.png&quot;</span>); <span class="comment">// Not /a/b.html/c.png
</span><span class="kw">let </span>base = Url::parse(<span class="string">&quot;https://example.net/a/b/&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>url = base.join(<span class="string">&quot;c.png&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.net/a/b/c.png&quot;</span>);</code></pre></div>
<h5 id="errors-2"><a href="#errors-2">Errors</a></h5>
<p>If the function can not parse an URL from the given string
with this URL as the base URL, a <a href="enum.ParseError.html"><code>ParseError</code></a> variant will be returned.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.make_relative" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#405">source</a><h4 class="code-header">pub fn <a href="#method.make_relative" class="fnname">make_relative</a>(&amp;self, url: &amp;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</h4></section></summary><div class="docblock"><p>Creates a relative URL if possible, with this URL as the base URL.</p>
<p>This is the inverse of <a href="#method.join"><code>join</code></a>.</p>
<h5 id="examples-3"><a href="#examples-3">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>base = Url::parse(<span class="string">&quot;https://example.net/a/b.html&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.net/a/c.png&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>relative = base.make_relative(<span class="kw-2">&amp;</span>url);
<span class="macro">assert_eq!</span>(relative.as_ref().map(|s| s.as_str()), <span class="prelude-val">Some</span>(<span class="string">&quot;c.png&quot;</span>));
<span class="kw">let </span>base = Url::parse(<span class="string">&quot;https://example.net/a/b/&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.net/a/b/c.png&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>relative = base.make_relative(<span class="kw-2">&amp;</span>url);
<span class="macro">assert_eq!</span>(relative.as_ref().map(|s| s.as_str()), <span class="prelude-val">Some</span>(<span class="string">&quot;c.png&quot;</span>));
<span class="kw">let </span>base = Url::parse(<span class="string">&quot;https://example.net/a/b/&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.net/a/d/c.png&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>relative = base.make_relative(<span class="kw-2">&amp;</span>url);
<span class="macro">assert_eq!</span>(relative.as_ref().map(|s| s.as_str()), <span class="prelude-val">Some</span>(<span class="string">&quot;../d/c.png&quot;</span>));
<span class="kw">let </span>base = Url::parse(<span class="string">&quot;https://example.net/a/b.html?c=d&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.net/a/b.html?e=f&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>relative = base.make_relative(<span class="kw-2">&amp;</span>url);
<span class="macro">assert_eq!</span>(relative.as_ref().map(|s| s.as_str()), <span class="prelude-val">Some</span>(<span class="string">&quot;?e=f&quot;</span>));</code></pre></div>
<h5 id="errors-3"><a href="#errors-3">Errors</a></h5>
<p>If this URL can’t be a base for the given URL, <code>None</code> is returned.
This is for example the case if the scheme, host or port are not the same.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.options" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#515">source</a><h4 class="code-header">pub fn <a href="#method.options" class="fnname">options</a>&lt;'a&gt;() -&gt; <a class="struct" href="../url/struct.ParseOptions.html" title="struct url::ParseOptions">ParseOptions</a>&lt;'a&gt;</h4></section></summary><div class="docblock"><p>Return a default <code>ParseOptions</code> that can fully configure the URL parser.</p>
<h5 id="examples-4"><a href="#examples-4">Examples</a></h5>
<p>Get default <code>ParseOptions</code>, then change base url</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>options = Url::options();
<span class="kw">let </span>api = Url::parse(<span class="string">&quot;https://api.example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>base_url = options.base_url(<span class="prelude-val">Some</span>(<span class="kw-2">&amp;</span>api));
<span class="kw">let </span>version_url = base_url.parse(<span class="string">&quot;version.json&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(version_url.as_str(), <span class="string">&quot;https://api.example.com/version.json&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_str" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#542">source</a><h4 class="code-header">pub 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></h4></section></summary><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>
<h5 id="examples-5"><a href="#examples-5">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url_str = <span class="string">&quot;https://example.net/&quot;</span>;
<span class="kw">let </span>url = Url::parse(url_str)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.as_str(), url_str);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_string" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#566">source</a><h4 class="code-header">pub fn <a href="#method.into_string" class="fnname">into_string</a>(self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section><span class="item-info"><div class="stab deprecated"><span class="emoji">👎</span><span>Deprecated since 2.3.0: use Into&lt;String&gt;</span></div></span></summary><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>
<h5 id="examples-6"><a href="#examples-6">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url_str = <span class="string">&quot;https://example.net/&quot;</span>;
<span class="kw">let </span>url = Url::parse(url_str)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(String::from(url), url_str);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.origin" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#765">source</a><h4 class="code-header">pub fn <a href="#method.origin" class="fnname">origin</a>(&amp;self) -&gt; <a class="enum" href="../url/origin/enum.Origin.html" title="enum url::origin::Origin">Origin</a></h4></section></summary><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 returns an opaque origin for <code>file:</code> URLs, which causes
<code>url.origin() != url.origin()</code>.</p>
<h5 id="examples-7"><a href="#examples-7">Examples</a></h5>
<p>URL with <code>ftp</code> scheme:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::{Host, Origin, Url};
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ftp://example.com/foo&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.origin(),
Origin::Tuple(<span class="string">&quot;ftp&quot;</span>.into(),
Host::Domain(<span class="string">&quot;example.com&quot;</span>.into()),
<span class="number">21</span>));</code></pre></div>
<p>URL with <code>blob</code> scheme:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::{Host, Origin, Url};
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;blob:https://example.com/foo&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.origin(),
Origin::Tuple(<span class="string">&quot;https&quot;</span>.into(),
Host::Domain(<span class="string">&quot;example.com&quot;</span>.into()),
<span class="number">443</span>));</code></pre></div>
<p>URL with <code>file</code> scheme:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::{Host, Origin, Url};
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;file:///tmp/foo&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(!url.origin().is_tuple());
<span class="kw">let </span>other_url = Url::parse(<span class="string">&quot;file:///tmp/foo&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(url.origin() != other_url.origin());</code></pre></div>
<p>URL with other scheme:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::{Host, Origin, Url};
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;foo:bar&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(!url.origin().is_tuple());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.scheme" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#785">source</a><h4 class="code-header">pub 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></h4></section></summary><div class="docblock"><p>Return the scheme of this URL, lower-cased, as an ASCII string without the ‘:’ delimiter.</p>
<h5 id="examples-8"><a href="#examples-8">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;file:///tmp/foo&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.scheme(), <span class="string">&quot;file&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.has_authority" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#815">source</a><h4 class="code-header">pub 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></h4></section></summary><div class="docblock"><p>Return whether the URL has an ‘authority’,
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>
<h5 id="examples-9"><a href="#examples-9">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ftp://rms@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(url.has_authority());
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;unix:/run/foo.socket&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(!url.has_authority());
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;data:text/plain,Stuff&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(!url.has_authority());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.cannot_be_a_base" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#846">source</a><h4 class="code-header">pub 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></h4></section></summary><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>
<h5 id="examples-10"><a href="#examples-10">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ftp://rms@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(!url.cannot_be_a_base());
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;unix:/run/foo.socket&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(!url.cannot_be_a_base());
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;data:text/plain,Stuff&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(url.cannot_be_a_base());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.username" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#872">source</a><h4 class="code-header">pub 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></h4></section></summary><div class="docblock"><p>Return the username for this URL (typically the empty string)
as a percent-encoded ASCII string.</p>
<h5 id="examples-11"><a href="#examples-11">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ftp://rms@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.username(), <span class="string">&quot;rms&quot;</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ftp://:secret123@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.username(), <span class="string">&quot;&quot;</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.username(), <span class="string">&quot;&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.password" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#905">source</a><h4 class="code-header">pub 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="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Return the password for this URL, if any, as a percent-encoded ASCII string.</p>
<h5 id="examples-12"><a href="#examples-12">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ftp://rms:secret123@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.password(), <span class="prelude-val">Some</span>(<span class="string">&quot;secret123&quot;</span>));
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ftp://:secret123@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.password(), <span class="prelude-val">Some</span>(<span class="string">&quot;secret123&quot;</span>));
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ftp://rms@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.password(), <span class="prelude-val">None</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.password(), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.has_host" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#940">source</a><h4 class="code-header">pub 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></h4></section></summary><div class="docblock"><p>Equivalent to <code>url.host().is_some()</code>.</p>
<h5 id="examples-13"><a href="#examples-13">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ftp://rms@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(url.has_host());
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;unix:/run/foo.socket&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(!url.has_host());
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;data:text/plain,Stuff&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(!url.has_host());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.host_str" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#977">source</a><h4 class="code-header">pub 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="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;</h4></section></summary><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 if this is the host
of a special URL, or percent encoded for non-special URLs.
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
don’t have a host.</p>
<p>See also the <code>host</code> method.</p>
<h5 id="examples-14"><a href="#examples-14">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://127.0.0.1/index.html&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.host_str(), <span class="prelude-val">Some</span>(<span class="string">&quot;127.0.0.1&quot;</span>));
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ftp://rms@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.host_str(), <span class="prelude-val">Some</span>(<span class="string">&quot;example.com&quot;</span>));
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;unix:/run/foo.socket&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.host_str(), <span class="prelude-val">None</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;data:text/plain,Stuff&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.host_str(), <span class="prelude-val">None</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.host" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1016">source</a><h4 class="code-header">pub 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="enum core::option::Option">Option</a>&lt;<a class="enum" href="../url/host/enum.Host.html" title="enum url::host::Host">Host</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Return the parsed representation of the host for this URL.
Non-ASCII domain labels are punycode-encoded per IDNA if this is the host
of a special URL, or percent encoded for non-special URLs.</p>
<p>Cannot-be-a-base URLs (typical of <code>data:</code> and <code>mailto:</code>) and some <code>file:</code> URLs
don’t have a host.</p>
<p>See also the <code>host_str</code> method.</p>
<h5 id="examples-15"><a href="#examples-15">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://127.0.0.1/index.html&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(url.host().is_some());
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ftp://rms@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(url.host().is_some());
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;unix:/run/foo.socket&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(url.host().is_none());
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;data:text/plain,Stuff&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(url.host().is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.domain" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1048">source</a><h4 class="code-header">pub 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="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>If this URL has a host and it is a domain name (not an IP address), return it.
Non-ASCII domains are punycode-encoded per IDNA if this is the host
of a special URL, or percent encoded for non-special URLs.</p>
<h5 id="examples-16"><a href="#examples-16">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://127.0.0.1/&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.domain(), <span class="prelude-val">None</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;mailto:rms@example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.domain(), <span class="prelude-val">None</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com/&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.domain(), <span class="prelude-val">Some</span>(<span class="string">&quot;example.com&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.port" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1080">source</a><h4 class="code-header">pub 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="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>&gt;</h4></section></summary><div class="docblock"><p>Return the port number for this URL, if any.</p>
<p>Note that default port numbers are never reflected by the serialization,
use the <code>port_or_known_default()</code> method if you want a default port number returned.</p>
<h5 id="examples-17"><a href="#examples-17">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.port(), <span class="prelude-val">None</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com:443/&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.port(), <span class="prelude-val">None</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;ssh://example.com:22&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.port(), <span class="prelude-val">Some</span>(<span class="number">22</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.port_or_known_default" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1112">source</a><h4 class="code-header">pub 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="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>&gt;</h4></section></summary><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> and <code>ftp</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>
<h5 id="examples-18"><a href="#examples-18">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;foo://example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.port_or_known_default(), <span class="prelude-val">None</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;foo://example.com:1456&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.port_or_known_default(), <span class="prelude-val">Some</span>(<span class="number">1456</span>));
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.port_or_known_default(), <span class="prelude-val">Some</span>(<span class="number">443</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.socket_addrs" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1143-1146">source</a><h4 class="code-header">pub fn <a href="#method.socket_addrs" class="fnname">socket_addrs</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;default_port_number: impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>() -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>&gt;<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/std/net/socket_addr/enum.SocketAddr.html" title="enum std::net::socket_addr::SocketAddr">SocketAddr</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/alloc/struct.Global.html" title="struct alloc::alloc::Global">Global</a>&gt;, <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;</h4></section></summary><div class="docblock"><p>Resolve a URL’s host and port number to <code>SocketAddr</code>.</p>
<p>If the URL has the default port number of a scheme that is unknown to this library,
<code>default_port_number</code> provides an opportunity to provide the actual port number.
In non-example code this should be implemented either simply as <code>|| None</code>,
or by matching on the URL’s <code>.scheme()</code>.</p>
<p>If the host is a domain, it is resolved using the standard library’s DNS support.</p>
<h5 id="examples-19"><a href="#examples-19">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>url = url::Url::parse(<span class="string">&quot;https://example.net/&quot;</span>).unwrap();
<span class="kw">let </span>addrs = url.socket_addrs(|| <span class="prelude-val">None</span>).unwrap();
std::net::TcpStream::connect(<span class="kw-2">&amp;*</span>addrs)</code></pre></div>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="doccomment">/// With application-specific known default port numbers
</span><span class="kw">fn </span>socket_addrs(url: url::Url) -&gt; std::io::Result&lt;Vec&lt;std::net::SocketAddr&gt;&gt; {
url.socket_addrs(|| <span class="kw">match </span>url.scheme() {
<span class="string">&quot;socks5&quot; </span>| <span class="string">&quot;socks5h&quot; </span>=&gt; <span class="prelude-val">Some</span>(<span class="number">1080</span>),
<span class="kw">_ </span>=&gt; <span class="prelude-val">None</span>,
})
}</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.path" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1194">source</a><h4 class="code-header">pub 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></h4></section></summary><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 doesn’t start with ‘/’.
For other URLs, this starts with a ‘/’ slash
and continues with slash-separated path segments.</p>
<h5 id="examples-20"><a href="#examples-20">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::{Url, ParseError};
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com/api/versions?page=2&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.path(), <span class="string">&quot;/api/versions&quot;</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.path(), <span class="string">&quot;/&quot;</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com/countries/việt nam&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.path(), <span class="string">&quot;/countries/vi%E1%BB%87t%20nam&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.path_segments" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1241">source</a><h4 class="code-header">pub 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="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/str/iter/struct.Split.html" title="struct core::str::iter::Split">Split</a>&lt;'_, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.char.html">char</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>Unless this URL is cannot-be-a-base,
return an iterator of ‘/’ 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>
<h5 id="examples-21"><a href="#examples-21">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com/foo/bar&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>path_segments = url.path_segments().ok_or_else(|| <span class="string">&quot;cannot be base&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(path_segments.next(), <span class="prelude-val">Some</span>(<span class="string">&quot;foo&quot;</span>));
<span class="macro">assert_eq!</span>(path_segments.next(), <span class="prelude-val">Some</span>(<span class="string">&quot;bar&quot;</span>));
<span class="macro">assert_eq!</span>(path_segments.next(), <span class="prelude-val">None</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>path_segments = url.path_segments().ok_or_else(|| <span class="string">&quot;cannot be base&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(path_segments.next(), <span class="prelude-val">Some</span>(<span class="string">&quot;&quot;</span>));
<span class="macro">assert_eq!</span>(path_segments.next(), <span class="prelude-val">None</span>);
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;data:text/plain,HelloWorld&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(url.path_segments().is_none());
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com/countries/việt nam&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>path_segments = url.path_segments().ok_or_else(|| <span class="string">&quot;cannot be base&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(path_segments.next(), <span class="prelude-val">Some</span>(<span class="string">&quot;countries&quot;</span>));
<span class="macro">assert_eq!</span>(path_segments.next(), <span class="prelude-val">Some</span>(<span class="string">&quot;vi%E1%BB%87t%20nam&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.query" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1270">source</a><h4 class="code-header">pub 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="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Return this URL’s query string, if any, as a percent-encoded ASCII string.</p>
<h5 id="examples-22"><a href="#examples-22">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">fn </span>run() -&gt; <span class="prelude-ty">Result</span>&lt;(), ParseError&gt; {
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com/products?page=2&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>query = url.query();
<span class="macro">assert_eq!</span>(query, <span class="prelude-val">Some</span>(<span class="string">&quot;page=2&quot;</span>));
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com/products&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>query = url.query();
<span class="macro">assert!</span>(query.is_none());
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com/?country=español&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>query = url.query();
<span class="macro">assert_eq!</span>(query, <span class="prelude-val">Some</span>(<span class="string">&quot;country=espa%C3%B1ol&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.query_pairs" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1309">source</a><h4 class="code-header">pub fn <a href="#method.query_pairs" class="fnname">query_pairs</a>(&amp;self) -&gt; <a class="struct" href="../form_urlencoded/struct.Parse.html" title="struct form_urlencoded::Parse">Parse</a>&lt;'_&gt;</h4></section></summary><div class="docblock"><p>Parse the URL’s query string, if any, as <code>application/x-www-form-urlencoded</code>
and return an iterator of (key, value) pairs.</p>
<h5 id="examples-23"><a href="#examples-23">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>std::borrow::Cow;
<span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com/products?page=2&amp;sort=desc&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>pairs = url.query_pairs();
<span class="macro">assert_eq!</span>(pairs.count(), <span class="number">2</span>);
<span class="macro">assert_eq!</span>(pairs.next(), <span class="prelude-val">Some</span>((Cow::Borrowed(<span class="string">&quot;page&quot;</span>), Cow::Borrowed(<span class="string">&quot;2&quot;</span>))));
<span class="macro">assert_eq!</span>(pairs.next(), <span class="prelude-val">Some</span>((Cow::Borrowed(<span class="string">&quot;sort&quot;</span>), Cow::Borrowed(<span class="string">&quot;desc&quot;</span>))));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fragment" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1345">source</a><h4 class="code-header">pub 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="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;</h4></section></summary><div class="docblock"><p>Return this URL’s fragment identifier, if any.</p>
<p>A fragment is the part of the URL after the <code>#</code> symbol.
The fragment is optional and, if present, contains a fragment identifier
that identifies a secondary resource, such as a section heading
of a document.</p>
<p>In HTML, the fragment identifier is usually the id attribute of a an element
that is scrolled to on load. Browsers typically will not send the fragment portion
of a URL to the server.</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>
<h5 id="examples-24"><a href="#examples-24">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com/data.csv#row=4&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.fragment(), <span class="prelude-val">Some</span>(<span class="string">&quot;row=4&quot;</span>));
<span class="kw">let </span>url = Url::parse(<span class="string">&quot;https://example.com/data.csv#cell=4,1-6,2&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.fragment(), <span class="prelude-val">Some</span>(<span class="string">&quot;cell=4,1-6,2&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_fragment" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1382">source</a><h4 class="code-header">pub 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="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;)</h4></section></summary><div class="docblock"><p>Change this URL’s fragment identifier.</p>
<h5 id="examples-25"><a href="#examples-25">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.com/data.csv&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.com/data.csv&quot;</span>);
url.set_fragment(<span class="prelude-val">Some</span>(<span class="string">&quot;cell=4,1-6,2&quot;</span>));
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.com/data.csv#cell=4,1-6,2&quot;</span>);
<span class="macro">assert_eq!</span>(url.fragment(), <span class="prelude-val">Some</span>(<span class="string">&quot;cell=4,1-6,2&quot;</span>));
url.set_fragment(<span class="prelude-val">None</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.com/data.csv&quot;</span>);
<span class="macro">assert!</span>(url.fragment().is_none());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_query" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1435">source</a><h4 class="code-header">pub 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="enum core::option::Option">Option</a>&lt;&amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;)</h4></section></summary><div class="docblock"><p>Change this URL’s query string.</p>
<h5 id="examples-26"><a href="#examples-26">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.com/products&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.com/products&quot;</span>);
url.set_query(<span class="prelude-val">Some</span>(<span class="string">&quot;page=2&quot;</span>));
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.com/products?page=2&quot;</span>);
<span class="macro">assert_eq!</span>(url.query(), <span class="prelude-val">Some</span>(<span class="string">&quot;page=2&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.query_pairs_mut" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1494">source</a><h4 class="code-header">pub fn <a href="#method.query_pairs_mut" class="fnname">query_pairs_mut</a>(&amp;mut self) -&gt; <a class="struct" href="../form_urlencoded/struct.Serializer.html" title="struct form_urlencoded::Serializer">Serializer</a>&lt;'_, <a class="struct" href="../url/struct.UrlQuery.html" title="struct url::UrlQuery">UrlQuery</a>&lt;'_&gt;&gt;</h4></section></summary><div class="docblock"><p>Manipulate this URL’s 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>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code>
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.net?lang=fr#nav&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.query(), <span class="prelude-val">Some</span>(<span class="string">&quot;lang=fr&quot;</span>));
url.query_pairs_mut().append_pair(<span class="string">&quot;foo&quot;</span>, <span class="string">&quot;bar&quot;</span>);
<span class="macro">assert_eq!</span>(url.query(), <span class="prelude-val">Some</span>(<span class="string">&quot;lang=fr&amp;foo=bar&quot;</span>));
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.net/?lang=fr&amp;foo=bar#nav&quot;</span>);
url.query_pairs_mut()
.clear()
.append_pair(<span class="string">&quot;foo&quot;</span>, <span class="string">&quot;bar &amp; baz&quot;</span>)
.append_pair(<span class="string">&quot;saisons&quot;</span>, <span class="string">&quot;\u{00C9}t\u{00E9}+hiver&quot;</span>);
<span class="macro">assert_eq!</span>(url.query(), <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>(url.as_str(),
<span class="string">&quot;https://example.net/?foo=bar+%26+baz&amp;saisons=%C3%89t%C3%A9%2Bhiver#nav&quot;</span>);</code></pre></div>
<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></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_path" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1560">source</a><h4 class="code-header">pub 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>)</h4></section></summary><div class="docblock"><p>Change this URL’s path.</p>
<h5 id="examples-27"><a href="#examples-27">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.com&quot;</span>)<span class="question-mark">?</span>;
url.set_path(<span class="string">&quot;api/comments&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.com/api/comments&quot;</span>);
<span class="macro">assert_eq!</span>(url.path(), <span class="string">&quot;/api/comments&quot;</span>);
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.com/api&quot;</span>)<span class="question-mark">?</span>;
url.set_path(<span class="string">&quot;data/report.csv&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.com/data/report.csv&quot;</span>);
<span class="macro">assert_eq!</span>(url.path(), <span class="string">&quot;/data/report.csv&quot;</span>);
<span class="comment">// `set_path` percent-encodes the given string if it&#39;s not already percent-encoded.
</span><span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.com&quot;</span>)<span class="question-mark">?</span>;
url.set_path(<span class="string">&quot;api/some comments&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.com/api/some%20comments&quot;</span>);
<span class="macro">assert_eq!</span>(url.path(), <span class="string">&quot;/api/some%20comments&quot;</span>);
<span class="comment">// `set_path` will not double percent-encode the string if it&#39;s already percent-encoded.
</span><span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.com&quot;</span>)<span class="question-mark">?</span>;
url.set_path(<span class="string">&quot;api/some%20comments&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.com/api/some%20comments&quot;</span>);
<span class="macro">assert_eq!</span>(url.path(), <span class="string">&quot;/api/some%20comments&quot;</span>);
</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.path_segments_mut" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1585">source</a><h4 class="code-header">pub 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="enum core::result::Result">Result</a>&lt;<a class="struct" href="../url/path_segments/struct.PathSegmentsMut.html" title="struct url::path_segments::PathSegmentsMut">PathSegmentsMut</a>&lt;'_&gt;, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</h4></section></summary><div class="docblock"><p>Return an object with methods to manipulate this URL’s path segments.</p>
<p>Return <code>Err(())</code> if this URL is cannot-be-a-base.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_port" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1669">source</a><h4 class="code-header">pub 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="enum 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="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</h4></section></summary><div class="docblock"><p>Change this URL’s port number.</p>
<p>Note that default port numbers are not reflected in the serialization.</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>
<h5 id="examples-28"><a href="#examples-28">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;ssh://example.net:2048/&quot;</span>)<span class="question-mark">?</span>;
url.set_port(<span class="prelude-val">Some</span>(<span class="number">4096</span>)).map_err(|<span class="kw">_</span>| <span class="string">&quot;cannot be base&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;ssh://example.net:4096/&quot;</span>);
url.set_port(<span class="prelude-val">None</span>).map_err(|<span class="kw">_</span>| <span class="string">&quot;cannot be base&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;ssh://example.net/&quot;</span>);</code></pre></div>
<p>Known default port numbers are not reflected:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.org/&quot;</span>)<span class="question-mark">?</span>;
url.set_port(<span class="prelude-val">Some</span>(<span class="number">443</span>)).map_err(|<span class="kw">_</span>| <span class="string">&quot;cannot be base&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert!</span>(url.port().is_none());</code></pre></div>
<p>Cannot set port for cannot-be-a-base URLs:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;mailto:rms@example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_port(<span class="prelude-val">Some</span>(<span class="number">80</span>));
<span class="macro">assert!</span>(result.is_err());
<span class="kw">let </span>result = url.set_port(<span class="prelude-val">None</span>);
<span class="macro">assert!</span>(result.is_err());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_host" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1802">source</a><h4 class="code-header">pub 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="enum 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="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="enum" href="../url/parser/enum.ParseError.html" title="enum url::parser::ParseError">ParseError</a>&gt;</h4></section></summary><div class="docblock"><p>Change this URL’s host.</p>
<p>Removing the host (calling this with <code>None</code>)
will also remove any username, password, and port number.</p>
<h5 id="examples-29"><a href="#examples-29">Examples</a></h5>
<p>Change host:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_host(<span class="prelude-val">Some</span>(<span class="string">&quot;rust-lang.org&quot;</span>));
<span class="macro">assert!</span>(result.is_ok());
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://rust-lang.org/&quot;</span>);</code></pre></div>
<p>Remove host:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;foo://example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_host(<span class="prelude-val">None</span>);
<span class="macro">assert!</span>(result.is_ok());
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;foo:/&quot;</span>);</code></pre></div>
<p>Cannot remove host for ‘special’ schemes (e.g. <code>http</code>):</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_host(<span class="prelude-val">None</span>);
<span class="macro">assert!</span>(result.is_err());
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.net/&quot;</span>);</code></pre></div>
<p>Cannot change or remove host for cannot-be-a-base URLs:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;mailto:rms@example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_host(<span class="prelude-val">Some</span>(<span class="string">&quot;rust-lang.org&quot;</span>));
<span class="macro">assert!</span>(result.is_err());
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;mailto:rms@example.net&quot;</span>);
<span class="kw">let </span>result = url.set_host(<span class="prelude-val">None</span>);
<span class="macro">assert!</span>(result.is_err());
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;mailto:rms@example.net&quot;</span>);</code></pre></div>
<h5 id="errors-4"><a href="#errors-4">Errors</a></h5>
<p>If this URL is cannot-be-a-base or there is an error parsing the given <code>host</code>,
a <a href="enum.ParseError.html"><code>ParseError</code></a> variant will be returned.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_ip_host" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1947">source</a><h4 class="code-header">pub 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_addr/enum.IpAddr.html" title="enum std::net::ip_addr::IpAddr">IpAddr</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</h4></section></summary><div class="docblock"><p>Change this URL’s 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>
<h5 id="examples-30"><a href="#examples-30">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::{Url, ParseError};
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;http://example.com&quot;</span>)<span class="question-mark">?</span>;
url.set_ip_host(<span class="string">&quot;127.0.0.1&quot;</span>.parse().unwrap());
<span class="macro">assert_eq!</span>(url.host_str(), <span class="prelude-val">Some</span>(<span class="string">&quot;127.0.0.1&quot;</span>));
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;http://127.0.0.1/&quot;</span>);</code></pre></div>
<p>Cannot change URL’s from mailto(cannot-be-base) to ip:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::{Url, ParseError};
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;mailto:rms@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_ip_host(<span class="string">&quot;127.0.0.1&quot;</span>.parse().unwrap());
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;mailto:rms@example.com&quot;</span>);
<span class="macro">assert!</span>(result.is_err());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_password" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#1987">source</a><h4 class="code-header">pub 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="enum 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="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</h4></section></summary><div class="docblock"><p>Change this URL’s 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>
<h5 id="examples-31"><a href="#examples-31">Examples</a></h5>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::{Url, ParseError};
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;mailto:rmz@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_password(<span class="prelude-val">Some</span>(<span class="string">&quot;secret_password&quot;</span>));
<span class="macro">assert!</span>(result.is_err());
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;ftp://user1:secret1@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_password(<span class="prelude-val">Some</span>(<span class="string">&quot;secret_password&quot;</span>));
<span class="macro">assert_eq!</span>(url.password(), <span class="prelude-val">Some</span>(<span class="string">&quot;secret_password&quot;</span>));
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;ftp://user2:@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_password(<span class="prelude-val">Some</span>(<span class="string">&quot;secret2&quot;</span>));
<span class="macro">assert!</span>(result.is_ok());
<span class="macro">assert_eq!</span>(url.password(), <span class="prelude-val">Some</span>(<span class="string">&quot;secret2&quot;</span>));</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_username" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2080">source</a><h4 class="code-header">pub 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="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</h4></section></summary><div class="docblock"><p>Change this URL’s 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>
<h5 id="examples-32"><a href="#examples-32">Examples</a></h5>
<p>Cannot setup username from mailto(cannot-be-base)</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::{Url, ParseError};
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;mailto:rmz@example.com&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_username(<span class="string">&quot;user1&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;mailto:rmz@example.com&quot;</span>);
<span class="macro">assert!</span>(result.is_err());</code></pre></div>
<p>Setup username to user1</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::{Url, ParseError};
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;ftp://:secre1@example.com/&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_username(<span class="string">&quot;user1&quot;</span>);
<span class="macro">assert!</span>(result.is_ok());
<span class="macro">assert_eq!</span>(url.username(), <span class="string">&quot;user1&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;ftp://user1:secre1@example.com/&quot;</span>);</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.set_scheme" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2242">source</a><h4 class="code-header">pub 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="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</h4></section></summary><div class="docblock"><p>Change this URL’s scheme.</p>
<p>Do nothing and return <code>Err</code> under the following circumstances:</p>
<ul>
<li>If the new scheme is not in <code>[a-zA-Z][a-zA-Z0-9+.-]+</code></li>
<li>If 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> or <code>ftp</code></li>
<li>If either the old or new scheme is <code>http</code>, <code>https</code>, <code>ws</code>,
<code>wss</code> or <code>ftp</code> and the other is not one of these</li>
<li>If the new scheme is <code>file</code> and this URL includes credentials
or has a non-null port</li>
<li>If this URL’s scheme is <code>file</code> and its host is empty or null</li>
</ul>
<p>See also <a href="https://url.spec.whatwg.org/#scheme-state">the URL specification’s section on legal scheme state
overrides</a>.</p>
<h5 id="examples-33"><a href="#examples-33">Examples</a></h5>
<p>Change the URL’s scheme from <code>https</code> to <code>http</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_scheme(<span class="string">&quot;http&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;http://example.net/&quot;</span>);
<span class="macro">assert!</span>(result.is_ok());</code></pre></div>
<p>Change the URL’s scheme from <code>foo</code> to <code>bar</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;foo://example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_scheme(<span class="string">&quot;bar&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;bar://example.net&quot;</span>);
<span class="macro">assert!</span>(result.is_ok());</code></pre></div>
<p>Cannot change URL’s scheme from <code>https</code> to <code>foõ</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;https://example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_scheme(<span class="string">&quot;foõ&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;https://example.net/&quot;</span>);
<span class="macro">assert!</span>(result.is_err());</code></pre></div>
<p>Cannot change URL’s scheme from <code>mailto</code> (cannot-be-a-base) to <code>https</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;mailto:rms@example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_scheme(<span class="string">&quot;https&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;mailto:rms@example.net&quot;</span>);
<span class="macro">assert!</span>(result.is_err());</code></pre></div>
<p>Cannot change the URL’s scheme from <code>foo</code> to <code>https</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;foo://example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_scheme(<span class="string">&quot;https&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;foo://example.net&quot;</span>);
<span class="macro">assert!</span>(result.is_err());</code></pre></div>
<p>Cannot change the URL’s scheme from <code>http</code> to <code>foo</code>:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span><span class="kw-2">mut </span>url = Url::parse(<span class="string">&quot;http://example.net&quot;</span>)<span class="question-mark">?</span>;
<span class="kw">let </span>result = url.set_scheme(<span class="string">&quot;foo&quot;</span>);
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;http://example.net/&quot;</span>);
<span class="macro">assert!</span>(result.is_err());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_file_path" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2322">source</a><h4 class="code-header">pub fn <a href="#method.from_file_path" class="fnname">from_file_path</a>&lt;P&gt;(path: P) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;,</span></h4></section></summary><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>) or a UNC prefix (<code>\\</code>).</p>
<h5 id="examples-34"><a href="#examples-34">Examples</a></h5>
<p>On Unix-like platforms:</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>url::Url;
<span class="kw">let </span>url = Url::from_file_path(<span class="string">&quot;/tmp/foo.txt&quot;</span>)<span class="question-mark">?</span>;
<span class="macro">assert_eq!</span>(url.as_str(), <span class="string">&quot;file:///tmp/foo.txt&quot;</span>);
<span class="kw">let </span>url = Url::from_file_path(<span class="string">&quot;../foo.txt&quot;</span>);
<span class="macro">assert!</span>(url.is_err());
<span class="kw">let </span>url = Url::from_file_path(<span class="string">&quot;https://google.com/&quot;</span>);
<span class="macro">assert!</span>(url.is_err());</code></pre></div>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_directory_path" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2359">source</a><h4 class="code-header">pub fn <a href="#method.from_directory_path" class="fnname">from_directory_path</a>&lt;P&gt;(path: P) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;P: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.Path.html" title="struct std::path::Path">Path</a>&gt;,</span></h4></section></summary><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>) or a UNC prefix (<code>\\</code>).</p>
<p>Compared to <code>from_file_path</code>, this ensure that URL’s 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></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.serialize_internal" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2375-2377">source</a><h4 class="code-header">pub fn <a href="#method.serialize_internal" class="fnname">serialize_internal</a>&lt;S&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;serializer: S<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;S as <a class="trait" href="../serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="../serde/ser/trait.Serializer.html#associatedtype.Ok" title="type serde::ser::Serializer::Ok">Ok</a>, &lt;S as <a class="trait" href="../serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="../serde/ser/trait.Serializer.html#associatedtype.Error" title="type serde::ser::Serializer::Error">Error</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>,</span></h4></section></summary><div class="docblock"><p>Serialize with Serde using the internal representation of the <code>Url</code> struct.</p>
<p>The corresponding <code>deserialize_internal</code> method sacrifices some invariant-checking
for speed, compared to the <code>Deserialize</code> trait impl.</p>
<p>This method is only available if the <code>serde</code> Cargo feature is enabled.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.deserialize_internal" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2417-2419">source</a><h4 class="code-header">pub fn <a href="#method.deserialize_internal" class="fnname">deserialize_internal</a>&lt;'de, D&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;deserializer: D<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>, &lt;D as <a class="trait" href="../serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a>&lt;'de&gt;&gt;::<a class="associatedtype" href="../serde/de/trait.Deserializer.html#associatedtype.Error" title="type serde::de::Deserializer::Error">Error</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;D: <a class="trait" href="../serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a>&lt;'de&gt;,</span></h4></section></summary><div class="docblock"><p>Serialize with Serde using the internal representation of the <code>Url</code> struct.</p>
<p>The corresponding <code>deserialize_internal</code> method sacrifices some invariant-checking
for speed, compared to the <code>Deserialize</code> trait impl.</p>
<p>This method is only available if the <code>serde</code> Cargo feature is enabled.</p>
</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_file_path" class="method has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2476">source</a><h4 class="code-header">pub 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="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/path/struct.PathBuf.html" title="struct std::path::PathBuf">PathBuf</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>&gt;</h4></section></summary><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 URL’s <code>scheme</code>,
and may give nonsensical results for other schemes.
It is the user’s responsibility to check the URL’s scheme before calling this.</p>
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>path = url.to_file_path();</code></pre></div>
<p>Returns <code>Err</code> if the host is neither empty nor <code>&quot;localhost&quot;</code> (except on Windows, where
<code>file:</code> URLs may have a non-local host),
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></details></div></details></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-AsRef%3Cstr%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2598">source</a><a href="#impl-AsRef%3Cstr%3E-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait 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="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="docblock"><p>Return the serialization of this URL.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.as_ref" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2600">source</a><a href="#method.as_ref" class="anchor"></a><h4 class="code-header">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></h4></section></summary><div class='docblock'>Converts this type into a shared reference of the (usually inferred) input type.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Clone-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#169">source</a><a href="#impl-Clone-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#169">source</a><a href="#method.clone" class="anchor"></a><h4 class="code-header">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="struct.Url.html" title="struct reqwest::Url">Url</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_from" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#132-134">source</a></span><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">const 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: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</h4></section></summary><div class='docblock'>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></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2541">source</a><a href="#impl-Debug-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="docblock"><p>Debug the serialization of this URL.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2543">source</a><a href="#method.fmt-1" class="anchor"></a><h4 class="code-header">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="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Deserialize%3C%27de%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2647">source</a><a href="#impl-Deserialize%3C%27de%3E-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;'de&gt; <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a>&lt;'de&gt; for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="docblock"><p>Deserializes this URL from a <code>serde</code> stream.</p>
<p>This implementation is only available if the <code>serde</code> Cargo feature is enabled.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.deserialize" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2648-2650">source</a><a href="#method.deserialize" class="anchor"></a><h4 class="code-header">fn <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize" class="fnname">deserialize</a>&lt;D&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;deserializer: D<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>, &lt;D as <a class="trait" href="../serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a>&lt;'de&gt;&gt;::<a class="associatedtype" href="../serde/de/trait.Deserializer.html#associatedtype.Error" title="type serde::de::Deserializer::Error">Error</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;D: <a class="trait" href="../serde/de/trait.Deserializer.html" title="trait serde::de::Deserializer">Deserializer</a>&lt;'de&gt;,</span></h4></section></summary><div class='docblock'>Deserialize this value from the given Serde deserializer. <a href="../serde/de/trait.Deserialize.html#tymethod.deserialize">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Display-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2526">source</a><a href="#impl-Display-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="docblock"><p>Display the serialization of this URL.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.fmt" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2528">source</a><a href="#method.fmt" class="anchor"></a><h4 class="code-header">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="struct core::fmt::Formatter">Formatter</a>&lt;'_&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-FromStr-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2508">source</a><a href="#impl-FromStr-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/str/traits/trait.FromStr.html" title="trait core::str::traits::FromStr">FromStr</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="docblock"><p>Parse a string as an URL, without a base URL or encoding override.</p>
</div><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Err" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Err" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/str/traits/trait.FromStr.html#associatedtype.Err" class="associatedtype">Err</a> = <a class="enum" href="../url/parser/enum.ParseError.html" title="enum url::parser::ParseError">ParseError</a></h4></section></summary><div class='docblock'>The associated error which can be returned from parsing.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_str" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2512">source</a><a href="#method.from_str" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/str/traits/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="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>, <a class="enum" href="../url/parser/enum.ParseError.html" title="enum url::parser::ParseError">ParseError</a>&gt;</h4></section></summary><div class='docblock'>Parses a string <code>s</code> to return a value of this type. <a href="https://doc.rust-lang.org/nightly/core/str/traits/trait.FromStr.html#tymethod.from_str">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Hash-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2587">source</a><a href="#impl-Hash-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="docblock"><p>URLs hash like their serialization.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.hash" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2589-2591">source</a><a href="#method.hash" class="anchor"></a><h4 class="code-header">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: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>H)<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,</span></h4></section></summary><div class='docblock'>Feeds this value into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#tymethod.hash">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.hash_slice" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.3.0">1.3.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/hash/mod.rs.html#237-239">source</a></span><a href="#method.hash_slice" class="anchor"></a><h4 class="code-header">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: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[Self]</a>, state: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>H)<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;H: <a class="trait" href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="trait core::hash::Hasher">Hasher</a>,</span></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hasher.html" title="Hasher"><code>Hasher</code></a>. <a href="https://doc.rust-lang.org/nightly/core/hash/trait.Hash.html#method.hash_slice">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Index%3CRange%3CPosition%3E%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/slicing.rs.html#33">source</a><a href="#impl-Index%3CRange%3CPosition%3E%3E-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a>&lt;<a class="enum" href="../url/slicing/enum.Position.html" title="enum url::slicing::Position">Position</a>&gt;&gt; for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Output-3" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Output-3" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.index-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/slicing.rs.html#35">source</a><a href="#method.index-3" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index" class="fnname">index</a>(&amp;self, range: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.Range.html" title="struct core::ops::range::Range">Range</a>&lt;<a class="enum" href="../url/slicing/enum.Position.html" title="enum url::slicing::Position">Position</a>&gt;) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Index%3CRangeFrom%3CPosition%3E%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/slicing.rs.html#19">source</a><a href="#impl-Index%3CRangeFrom%3CPosition%3E%3E-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFrom.html" title="struct core::ops::range::RangeFrom">RangeFrom</a>&lt;<a class="enum" href="../url/slicing/enum.Position.html" title="enum url::slicing::Position">Position</a>&gt;&gt; for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Output-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Output-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.index-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/slicing.rs.html#21">source</a><a href="#method.index-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index" class="fnname">index</a>(&amp;self, range: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFrom.html" title="struct core::ops::range::RangeFrom">RangeFrom</a>&lt;<a class="enum" href="../url/slicing/enum.Position.html" title="enum url::slicing::Position">Position</a>&gt;) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Index%3CRangeFull%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/slicing.rs.html#12">source</a><a href="#impl-Index%3CRangeFull%3E-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFull.html" title="struct core::ops::range::RangeFull">RangeFull</a>&gt; for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Output" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.index" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/slicing.rs.html#14">source</a><a href="#method.index" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index" class="fnname">index</a>(&amp;self, <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeFull.html" title="struct core::ops::range::RangeFull">RangeFull</a>) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Index%3CRangeTo%3CPosition%3E%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/slicing.rs.html#26">source</a><a href="#impl-Index%3CRangeTo%3CPosition%3E%3E-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html" title="trait core::ops::index::Index">Index</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeTo.html" title="struct core::ops::range::RangeTo">RangeTo</a>&lt;<a class="enum" href="../url/slicing/enum.Position.html" title="enum url::slicing::Position">Position</a>&gt;&gt; for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Output-2" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Output-2" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#associatedtype.Output" class="associatedtype">Output</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></section></summary><div class='docblock'>The returned type after indexing.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.index-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/slicing.rs.html#28">source</a><a href="#method.index-2" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index" class="fnname">index</a>(&amp;self, range: <a class="struct" href="https://doc.rust-lang.org/nightly/core/ops/range/struct.RangeTo.html" title="struct core::ops::range::RangeTo">RangeTo</a>&lt;<a class="enum" href="../url/slicing/enum.Position.html" title="enum url::slicing::Position">Position</a>&gt;) -&gt; &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></section></summary><div class='docblock'>Performs the indexing (<code>container[index]</code>) operation. <a href="https://doc.rust-lang.org/nightly/core/ops/index/trait.Index.html#tymethod.index">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Ord-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2571">source</a><a href="#impl-Ord-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html" title="trait core::cmp::Ord">Ord</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="docblock"><p>URLs compare like their serialization.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.cmp" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2573">source</a><a href="#method.cmp" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#tymethod.cmp" class="fnname">cmp</a>(&amp;self, other: &amp;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a></h4></section></summary><div class='docblock'>This method returns an <a href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="Ordering"><code>Ordering</code></a> 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></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.max" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#795-798">source</a></span><a href="#method.max" class="anchor"></a><h4 class="code-header">const fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max" class="fnname">max</a>(self, other: Self) -&gt; Self</h4></section></summary><div class='docblock'>Compares and returns the maximum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.max">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.min" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.21.0">1.21.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#822-825">source</a></span><a href="#method.min" class="anchor"></a><h4 class="code-header">const fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min" class="fnname">min</a>(self, other: Self) -&gt; Self</h4></section></summary><div class='docblock'>Compares and returns the minimum of two values. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.min">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clamp" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.50.0">1.50.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#854-858">source</a></span><a href="#method.clamp" class="anchor"></a><h4 class="code-header">const fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp" class="fnname">clamp</a>(self, min: Self, max: Self) -&gt; Self<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;Self&gt;,</span></h4></section></summary><div class='docblock'>Restrict a value to a certain interval. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Ord.html#method.clamp">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CUrl%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2563">source</a><a href="#impl-PartialEq%3CUrl%3E-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a>&lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>&gt; for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="docblock"><p>URLs compare like their serialization.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2565">source</a><a href="#method.eq" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq" class="fnname">eq</a>(&amp;self, other: &amp;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ne" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#227">source</a></span><a href="#method.ne" class="anchor"></a><h4 class="code-header">const fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fnname">ne</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>This method tests for <code>!=</code>. The default implementation is almost always
sufficient, and should not be overridden without very good reason. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialOrd%3CUrl%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2579">source</a><a href="#impl-PartialOrd%3CUrl%3E-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html" title="trait core::cmp::PartialOrd">PartialOrd</a>&lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>&gt; for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="docblock"><p>URLs compare like their serialization.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.partial_cmp" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2581">source</a><a href="#method.partial_cmp" class="anchor"></a><h4 class="code-header">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;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/cmp/enum.Ordering.html" title="enum core::cmp::Ordering">Ordering</a>&gt;</h4></section></summary><div class='docblock'>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></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.lt" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1119">source</a></span><a href="#method.lt" class="anchor"></a><h4 class="code-header">const fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.lt" class="fnname">lt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.le" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1138">source</a></span><a href="#method.le" class="anchor"></a><h4 class="code-header">const fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.le" class="fnname">le</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.gt" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1156">source</a></span><a href="#method.gt" class="anchor"></a><h4 class="code-header">const fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.gt" class="fnname">gt</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ge" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#1175">source</a></span><a href="#method.ge" class="anchor"></a><h4 class="code-header">const fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialOrd.html#method.ge" class="fnname">ge</a>(&amp;self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Rhs) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>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></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Serialize-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2634">source</a><a href="#impl-Serialize-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="../serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="docblock"><p>Serializes this URL into a <code>serde</code> stream.</p>
<p>This implementation is only available if the <code>serde</code> Cargo feature is enabled.</p>
</div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.serialize" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2635-2637">source</a><a href="#method.serialize" class="anchor"></a><h4 class="code-header">fn <a href="../serde/ser/trait.Serialize.html#tymethod.serialize" class="fnname">serialize</a>&lt;S&gt;(<br>&nbsp;&nbsp;&nbsp;&nbsp;&amp;self,<br>&nbsp;&nbsp;&nbsp;&nbsp;serializer: S<br>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&lt;S as <a class="trait" href="../serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="../serde/ser/trait.Serializer.html#associatedtype.Ok" title="type serde::ser::Serializer::Ok">Ok</a>, &lt;S as <a class="trait" href="../serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>&gt;::<a class="associatedtype" href="../serde/ser/trait.Serializer.html#associatedtype.Error" title="type serde::ser::Serializer::Error">Error</a>&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="../serde/ser/trait.Serializer.html" title="trait serde::ser::Serializer">Serializer</a>,</span></h4></section></summary><div class='docblock'>Serialize this value into the given Serde serializer. <a href="../serde/ser/trait.Serialize.html#tymethod.serialize">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-TryFrom%3C%26%27a%20str%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2517">source</a><a href="#impl-TryFrom%3C%26%27a%20str%3E-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;'a&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;&amp;'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt; for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="../url/parser/enum.ParseError.html" title="enum url::parser::ParseError">ParseError</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2520">source</a><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(s: &amp;'a <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="enum core::result::Result">Result</a>&lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a>, &lt;<a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a> as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;&amp;'a <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><section id="impl-Eq-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/url/lib.rs.html#2560">source</a><a href="#impl-Eq-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section><div class="docblock"><p>URLs compare like their serialization.</p>
</div><section id="impl-IntoUrl-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/reqwest/into_url.rs.html#9">source</a><a href="#impl-IntoUrl-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="trait.IntoUrl.html" title="trait reqwest::IntoUrl">IntoUrl</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><section id="impl-RefUnwindSafe-for-Url" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section><section id="impl-Send-for-Url" class="impl has-srclink"><a href="#impl-Send-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section><section id="impl-Sync-for-Url" class="impl has-srclink"><a href="#impl-Sync-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section><section id="impl-Unpin-for-Url" class="impl has-srclink"><a href="#impl-Unpin-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section><section id="impl-UnwindSafe-for-Url" class="impl has-srclink"><a href="#impl-UnwindSafe-for-Url" class="anchor"></a><h3 class="code-header">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.Url.html" title="struct reqwest::Url">Url</a></h3></section></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Any-for-Url" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#200">source</a><a href="#impl-Any-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.type_id" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#201">source</a><a href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#211">source</a><a href="#impl-Borrow%3CT%3E-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213">source</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220">source</a><a href="#impl-BorrowMut%3CT%3E-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.borrow_mut" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221">source</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Equivalent%3CK%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/indexmap/equivalent.rs.html#18">source</a><a href="#impl-Equivalent%3CK%3E-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;Q, K&gt; <a class="trait" href="../indexmap/equivalent/trait.Equivalent.html" title="trait indexmap::equivalent::Equivalent">Equivalent</a>&lt;K&gt; for Q<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;Q: <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;K: <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;Q&gt; + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.equivalent" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/indexmap/equivalent.rs.html#24">source</a><a href="#method.equivalent" class="anchor"></a><h4 class="code-header">fn <a href="../indexmap/equivalent/trait.Equivalent.html#tymethod.equivalent" class="fnname">equivalent</a>(&amp;self, key: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>K) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></section></summary><div class='docblock'>Compare self to <code>key</code> and return <code>true</code> if they are equal.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#733">source</a><a href="#impl-From%3CT%3E-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#736">source</a></span><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -&gt; T</h4></section></summary><div class="docblock"><p>Returns the argument unchanged.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Instrument-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#276">source</a><a href="#impl-Instrument-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.instrument" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#82">source</a><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="../tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="../tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -&gt; <a class="struct" href="../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Instruments this type with the provided <a href="../tracing/span/struct.Span.html" title="Span"><code>Span</code></a>, returning an
<code>Instrumented</code> wrapper. <a href="../tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.in_current_span" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#121">source</a><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="../tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -&gt; <a class="struct" href="../tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Instruments this type with the <a href="../tracing/span/struct.Span.html#method.current">current</a> <a href="../tracing/span/struct.Span.html"><code>Span</code></a>, returning an
<code>Instrumented</code> wrapper. <a href="../tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Into%3CU%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#717">source</a><a href="#impl-Into%3CU%3E-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#725">source</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -&gt; U</h4></section></summary><div class="docblock"><p>Calls <code>U::from(self)</code>.</p>
<p>That is, this conversion is whatever the implementation of
<code><a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="From">From</a>&lt;T&gt; for U</code> chooses to do.</p>
</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToOwned-for-Url" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#83">source</a><a href="#impl-ToOwned-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Owned" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Owned" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="associatedtype">Owned</a> = T</h4></section></summary><div class='docblock'>The resulting type after obtaining ownership.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_owned" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#88">source</a><a href="#method.to_owned" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&amp;self) -&gt; T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.clone_into" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#92">source</a><a href="#method.clone_into" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&amp;self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToString-for-Url" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2497">source</a><a href="#impl-ToString-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.to_string" class="method trait-impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2503">source</a><a href="#method.to_string" class="anchor"></a><h4 class="code-header">default fn <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string" class="fnname">to_string</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></section></summary><div class='docblock'>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#775">source</a><a href="#impl-TryFrom%3CU%3E-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-2" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-2" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_from-1" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#781">source</a></span><a href="#method.try_from-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, &lt;T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;U&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryInto%3CU%3E-for-Url" class="impl has-srclink"><a class="srclink rightside" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#760">source</a><a href="#impl-TryInto%3CU%3E-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T, U&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a>&lt;U&gt; for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-1" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="associatedtype">Error</a> = &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></section></summary><div class='docblock'>The type returned in the event of a conversion error.</div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.try_into" class="method trait-impl has-srclink"><span class="rightside"><span class="since" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span> · <a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#766">source</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;U, &lt;U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a>&lt;T&gt;&gt;::<a class="associatedtype" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>&gt;</h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-WithSubscriber-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#334">source</a><a href="#impl-WithSubscriber-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../tracing/instrument/trait.WithSubscriber.html" title="trait tracing::instrument::WithSubscriber">WithSubscriber</a> for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.with_subscriber" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#169-171">source</a><a href="#method.with_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="../tracing/instrument/trait.WithSubscriber.html#method.with_subscriber" class="fnname">with_subscriber</a>&lt;S&gt;(self, subscriber: S) -&gt; <a class="struct" href="../tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a>&lt;Self&gt;<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;S: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="struct" href="../tracing_core/dispatcher/struct.Dispatch.html" title="struct tracing_core::dispatcher::Dispatch">Dispatch</a>&gt;,</span></h4></section></summary><div class='docblock'>Attaches the provided <a href="../tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
<a href="../tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="../tracing/instrument/trait.WithSubscriber.html#method.with_subscriber">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.with_current_subscriber" class="method trait-impl has-srclink"><a class="srclink rightside" href="../src/tracing/instrument.rs.html#221">source</a><a href="#method.with_current_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="../tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber" class="fnname">with_current_subscriber</a>(self) -&gt; <a class="struct" href="../tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a>&lt;Self&gt;</h4></section></summary><div class='docblock'>Attaches the current <a href="../tracing/dispatcher/index.html#setting-the-default-subscriber">default</a> <a href="../tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
<a href="../tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="../tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber">Read more</a></div></details></div></details><section id="impl-DeserializeOwned-for-Url" class="impl has-srclink"><a class="srclink rightside" href="../src/serde/de/mod.rs.html#604">source</a><a href="#impl-DeserializeOwned-for-Url" class="anchor"></a><h3 class="code-header">impl&lt;T&gt; <a class="trait" href="../serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a> for T<span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: for&lt;'de&gt; <a class="trait" href="../serde/de/trait.Deserialize.html" title="trait serde::de::Deserialize">Deserialize</a>&lt;'de&gt;,</span></h3></section></div></section></div></main><div id="rustdoc-vars" data-root-path="../" data-current-crate="reqwest" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html>