| <!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="The URI component of a request."><meta name="keywords" content="rust, rustlang, rust-lang, Uri"><title>Uri in http::uri - 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">☰</button><a class="sidebar-logo" href="../../http/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="../../http/index.html"><div class="logo-container"><img class="rust-logo" src="../../rust-logo.svg" alt="logo"></div></a><h2 class="location"><a href="#">Uri</a></h2><div class="sidebar-elems"><section><h3><a href="#implementations">Methods</a></h3><ul class="block"><li><a href="#method.authority">authority</a></li><li><a href="#method.builder">builder</a></li><li><a href="#method.from_maybe_shared">from_maybe_shared</a></li><li><a href="#method.from_parts">from_parts</a></li><li><a href="#method.from_static">from_static</a></li><li><a href="#method.host">host</a></li><li><a href="#method.into_parts">into_parts</a></li><li><a href="#method.path">path</a></li><li><a href="#method.path_and_query">path_and_query</a></li><li><a href="#method.port">port</a></li><li><a href="#method.port_u16">port_u16</a></li><li><a href="#method.query">query</a></li><li><a href="#method.scheme">scheme</a></li><li><a href="#method.scheme_str">scheme_str</a></li></ul><h3><a href="#trait-implementations">Trait Implementations</a></h3><ul class="block"><li><a href="#impl-Clone-for-Uri">Clone</a></li><li><a href="#impl-Debug-for-Uri">Debug</a></li><li><a href="#impl-Default-for-Uri">Default</a></li><li><a href="#impl-Display-for-Uri">Display</a></li><li><a href="#impl-Eq-for-Uri">Eq</a></li><li><a href="#impl-From%3CAuthority%3E-for-Uri">From<Authority></a></li><li><a href="#impl-From%3CPathAndQuery%3E-for-Uri">From<PathAndQuery></a></li><li><a href="#impl-From%3CUri%3E-for-Parts">From<Uri></a></li><li><a href="#impl-FromStr-for-Uri">FromStr</a></li><li><a href="#impl-Hash-for-Uri">Hash</a></li><li><a href="#impl-PartialEq%3C%26%27a%20str%3E-for-Uri">PartialEq<&'a str></a></li><li><a href="#impl-PartialEq%3CUri%3E-for-%26%27a%20str">PartialEq<Uri></a></li><li><a href="#impl-PartialEq%3CUri%3E-for-Uri">PartialEq<Uri></a></li><li><a href="#impl-PartialEq%3CUri%3E-for-str">PartialEq<Uri></a></li><li><a href="#impl-PartialEq%3Cstr%3E-for-Uri">PartialEq<str></a></li><li><a href="#impl-TryFrom%3C%26%27a%20%5Bu8%5D%3E-for-Uri">TryFrom<&'a [u8]></a></li><li><a href="#impl-TryFrom%3C%26%27a%20String%3E-for-Uri">TryFrom<&'a String></a></li><li><a href="#impl-TryFrom%3C%26%27a%20Uri%3E-for-Uri">TryFrom<&'a Uri></a></li><li><a href="#impl-TryFrom%3C%26%27a%20str%3E-for-Uri">TryFrom<&'a str></a></li><li><a href="#impl-TryFrom%3CParts%3E-for-Uri">TryFrom<Parts></a></li><li><a href="#impl-TryFrom%3CString%3E-for-Uri">TryFrom<String></a></li><li><a href="#impl-TryFrom%3CVec%3Cu8%2C%20Global%3E%3E-for-Uri">TryFrom<Vec<u8, Global>></a></li></ul><h3><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><ul class="block"><li><a href="#impl-RefUnwindSafe-for-Uri">RefUnwindSafe</a></li><li><a href="#impl-Send-for-Uri">Send</a></li><li><a href="#impl-Sync-for-Uri">Sync</a></li><li><a href="#impl-Unpin-for-Uri">Unpin</a></li><li><a href="#impl-UnwindSafe-for-Uri">UnwindSafe</a></li></ul><h3><a href="#blanket-implementations">Blanket Implementations</a></h3><ul class="block"><li><a href="#impl-Any-for-Uri">Any</a></li><li><a href="#impl-Borrow%3CT%3E-for-Uri">Borrow<T></a></li><li><a href="#impl-BorrowMut%3CT%3E-for-Uri">BorrowMut<T></a></li><li><a href="#impl-From%3CT%3E-for-Uri">From<T></a></li><li><a href="#impl-Into%3CU%3E-for-Uri">Into<U></a></li><li><a href="#impl-ToOwned-for-Uri">ToOwned</a></li><li><a href="#impl-ToString-for-Uri">ToString</a></li><li><a href="#impl-TryFrom%3CU%3E-for-Uri">TryFrom<U></a></li><li><a href="#impl-TryInto%3CU%3E-for-Uri">TryInto<U></a></li></ul></section><h2><a href="index.html">In http::uri</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">http</a>::<wbr><a href="index.html">uri</a>::<wbr><a class="struct" href="#">Uri</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/http/uri/mod.rs.html#96-100">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="item-decl"><pre class="rust struct"><code>pub struct Uri { /* private fields */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>The URI component of a request.</p> |
| <p>For HTTP 1, this is included as part of the request line. From Section 5.3, |
| Request Target:</p> |
| <blockquote> |
| <p>Once an inbound connection is obtained, the client sends an HTTP |
| request message (Section 3) with a request-target derived from the |
| target URI. There are four distinct formats for the request-target, |
| depending on both the method being requested and whether the request |
| is to a proxy.</p> |
| <div class="example-wrap"><pre class="language-notrust"><code>request-target = origin-form |
| / absolute-form |
| / authority-form |
| / asterisk-form</code></pre></div></blockquote> |
| <p>The URI is structured as follows:</p> |
| <div class="example-wrap"><pre class="language-notrust"><code>abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1 |
| |-| |-------------------------------||--------| |-------------------| |-----| |
| | | | | | |
| scheme authority path query fragment</code></pre></div> |
| <p>For HTTP 2.0, the URI is encoded using pseudoheaders.</p> |
| <h2 id="examples"><a href="#examples">Examples</a></h2> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>http::Uri; |
| |
| <span class="kw">let </span>uri = <span class="string">"/foo/bar?baz"</span>.parse::<Uri>().unwrap(); |
| <span class="macro">assert_eq!</span>(uri.path(), <span class="string">"/foo/bar"</span>); |
| <span class="macro">assert_eq!</span>(uri.query(), <span class="prelude-val">Some</span>(<span class="string">"baz"</span>)); |
| <span class="macro">assert_eq!</span>(uri.host(), <span class="prelude-val">None</span>); |
| |
| <span class="kw">let </span>uri = <span class="string">"https://www.rust-lang.org/install.html"</span>.parse::<Uri>().unwrap(); |
| <span class="macro">assert_eq!</span>(uri.scheme_str(), <span class="prelude-val">Some</span>(<span class="string">"https"</span>)); |
| <span class="macro">assert_eq!</span>(uri.host(), <span class="prelude-val">Some</span>(<span class="string">"www.rust-lang.org"</span>)); |
| <span class="macro">assert_eq!</span>(uri.path(), <span class="string">"/install.html"</span>);</code></pre></div> |
| </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-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#182-707">source</a><a href="#impl-Uri" class="anchor"></a><h3 class="code-header">impl <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.builder" class="method has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#200-202">source</a><h4 class="code-header">pub fn <a href="#method.builder" class="fnname">builder</a>() -> <a class="struct" href="struct.Builder.html" title="struct http::uri::Builder">Builder</a></h4></section></summary><div class="docblock"><p>Creates a new builder-style object to manufacture a <code>Uri</code>.</p> |
| <p>This method returns an instance of <code>Builder</code> which can be usd to |
| create a <code>Uri</code>.</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>http::Uri; |
| |
| <span class="kw">let </span>uri = Uri::builder() |
| .scheme(<span class="string">"https"</span>) |
| .authority(<span class="string">"hyper.rs"</span>) |
| .path_and_query(<span class="string">"/"</span>) |
| .build() |
| .unwrap();</code></pre></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_parts" class="method has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#238-275">source</a><h4 class="code-header">pub fn <a href="#method.from_parts" class="fnname">from_parts</a>(src: <a class="struct" href="struct.Parts.html" title="struct http::uri::Parts">Parts</a>) -> Result<<a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>, <a class="struct" href="struct.InvalidUriParts.html" title="struct http::uri::InvalidUriParts">InvalidUriParts</a>></h4></section></summary><div class="docblock"><p>Attempt to convert a <code>Parts</code> into a <code>Uri</code>.</p> |
| <h5 id="examples-2"><a href="#examples-2">Examples</a></h5> |
| <p>Relative URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>parts = Parts::default(); |
| parts.path_and_query = <span class="prelude-val">Some</span>(<span class="string">"/foo"</span>.parse().unwrap()); |
| |
| <span class="kw">let </span>uri = Uri::from_parts(parts).unwrap(); |
| |
| <span class="macro">assert_eq!</span>(uri.path(), <span class="string">"/foo"</span>); |
| |
| <span class="macro">assert!</span>(uri.scheme().is_none()); |
| <span class="macro">assert!</span>(uri.authority().is_none());</code></pre></div> |
| <p>Absolute URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span><span class="kw-2">mut </span>parts = Parts::default(); |
| parts.scheme = <span class="prelude-val">Some</span>(<span class="string">"http"</span>.parse().unwrap()); |
| parts.authority = <span class="prelude-val">Some</span>(<span class="string">"foo.com"</span>.parse().unwrap()); |
| parts.path_and_query = <span class="prelude-val">Some</span>(<span class="string">"/foo"</span>.parse().unwrap()); |
| |
| <span class="kw">let </span>uri = Uri::from_parts(parts).unwrap(); |
| |
| <span class="macro">assert_eq!</span>(uri.scheme().unwrap().as_str(), <span class="string">"http"</span>); |
| <span class="macro">assert_eq!</span>(uri.authority().unwrap(), <span class="string">"foo.com"</span>); |
| <span class="macro">assert_eq!</span>(uri.path(), <span class="string">"/foo"</span>);</code></pre></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_maybe_shared" class="method has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#281-290">source</a><h4 class="code-header">pub fn <a href="#method.from_maybe_shared" class="fnname">from_maybe_shared</a><T>(src: T) -> Result<Self, <a class="struct" href="struct.InvalidUri.html" title="struct http::uri::InvalidUri">InvalidUri</a>><span class="where fmt-newline">where<br> T: AsRef<[u8]> + 'static,</span></h4></section></summary><div class="docblock"><p>Attempt to convert a <code>Bytes</code> buffer to a <code>Uri</code>.</p> |
| <p>This will try to prevent a copy if the type passed is the type used |
| internally, and will copy the data if it is not.</p> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from_static" class="method has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#361-367">source</a><h4 class="code-header">pub fn <a href="#method.from_static" class="fnname">from_static</a>(src: &'static str) -> Self</h4></section></summary><div class="docblock"><p>Convert a <code>Uri</code> from a static string.</p> |
| <p>This function will not perform any copying, however the string is |
| checked to ensure that it is valid.</p> |
| <h5 id="panics"><a href="#panics">Panics</a></h5> |
| <p>This function panics if the argument is an invalid URI.</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">let </span>uri = Uri::from_static(<span class="string">"http://example.com/foo"</span>); |
| |
| <span class="macro">assert_eq!</span>(uri.host().unwrap(), <span class="string">"example.com"</span>); |
| <span class="macro">assert_eq!</span>(uri.path(), <span class="string">"/foo"</span>);</code></pre></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.into_parts" class="method has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#390-392">source</a><h4 class="code-header">pub fn <a href="#method.into_parts" class="fnname">into_parts</a>(self) -> <a class="struct" href="struct.Parts.html" title="struct http::uri::Parts">Parts</a></h4></section></summary><div class="docblock"><p>Convert a <code>Uri</code> into <code>Parts</code>.</p> |
| <h5 id="note"><a href="#note">Note</a></h5> |
| <p>This is just an inherent method providing the same functionality as |
| <code>let parts: Parts = uri.into()</code></p> |
| <h5 id="examples-4"><a href="#examples-4">Examples</a></h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"/foo"</span>.parse().unwrap(); |
| |
| <span class="kw">let </span>parts = uri.into_parts(); |
| |
| <span class="macro">assert_eq!</span>(parts.path_and_query.unwrap(), <span class="string">"/foo"</span>); |
| |
| <span class="macro">assert!</span>(parts.scheme.is_none()); |
| <span class="macro">assert!</span>(parts.authority.is_none());</code></pre></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.path_and_query" class="method has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#396-402">source</a><h4 class="code-header">pub fn <a href="#method.path_and_query" class="fnname">path_and_query</a>(&self) -> Option<&<a class="struct" href="struct.PathAndQuery.html" title="struct http::uri::PathAndQuery">PathAndQuery</a>></h4></section></summary><div class="docblock"><p>Returns the path & query components of the Uri</p> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.path" class="method has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#439-445">source</a><h4 class="code-header">pub fn <a href="#method.path" class="fnname">path</a>(&self) -> &str</h4></section></summary><div class="docblock"><p>Get the path of this <code>Uri</code>.</p> |
| <p>Both relative and absolute URIs contain a path component, though it |
| might be the empty string. The path component is <strong>case sensitive</strong>.</p> |
| <div class="example-wrap"><pre class="language-notrust"><code>abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1 |
| |--------| |
| | |
| path</code></pre></div> |
| <p>If the URI is <code>*</code> then the path component is equal to <code>*</code>.</p> |
| <h5 id="examples-5"><a href="#examples-5">Examples</a></h5> |
| <p>A relative URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code> |
| <span class="kw">let </span>uri: Uri = <span class="string">"/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert_eq!</span>(uri.path(), <span class="string">"/hello/world"</span>);</code></pre></div> |
| <p>An absolute URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"http://example.org/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert_eq!</span>(uri.path(), <span class="string">"/hello/world"</span>);</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/http/uri/mod.rs.html#483-489">source</a><h4 class="code-header">pub fn <a href="#method.scheme" class="fnname">scheme</a>(&self) -> Option<&<a class="struct" href="struct.Scheme.html" title="struct http::uri::Scheme">Scheme</a>></h4></section></summary><div class="docblock"><p>Get the scheme of this <code>Uri</code>.</p> |
| <p>The URI scheme refers to a specification for assigning identifiers |
| within that scheme. Only absolute URIs contain a scheme component, but |
| not all absolute URIs will contain a scheme component. Although scheme |
| names are case-insensitive, the canonical form is lowercase.</p> |
| <div class="example-wrap"><pre class="language-notrust"><code>abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1 |
| |-| |
| | |
| scheme</code></pre></div><h5 id="examples-6"><a href="#examples-6">Examples</a></h5> |
| <p>Absolute URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>http::uri::{Scheme, Uri}; |
| |
| <span class="kw">let </span>uri: Uri = <span class="string">"http://example.org/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert_eq!</span>(uri.scheme(), <span class="prelude-val">Some</span>(<span class="kw-2">&</span>Scheme::HTTP));</code></pre></div> |
| <p>Relative URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert!</span>(uri.scheme().is_none());</code></pre></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.scheme_str" class="method has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#502-508">source</a><h4 class="code-header">pub fn <a href="#method.scheme_str" class="fnname">scheme_str</a>(&self) -> Option<&str></h4></section></summary><div class="docblock"><p>Get the scheme of this <code>Uri</code> as a <code>&str</code>.</p> |
| <h5 id="example"><a href="#example">Example</a></h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"http://example.org/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert_eq!</span>(uri.scheme_str(), <span class="prelude-val">Some</span>(<span class="string">"http"</span>));</code></pre></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.authority" class="method has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#548-554">source</a><h4 class="code-header">pub fn <a href="#method.authority" class="fnname">authority</a>(&self) -> Option<&<a class="struct" href="struct.Authority.html" title="struct http::uri::Authority">Authority</a>></h4></section></summary><div class="docblock"><p>Get the authority of this <code>Uri</code>.</p> |
| <p>The authority is a hierarchical element for naming authority such that |
| the remainder of the URI is delegated to that authority. For HTTP, the |
| authority consists of the host and port. The host portion of the |
| authority is <strong>case-insensitive</strong>.</p> |
| <p>The authority also includes a <code>username:password</code> component, however |
| the use of this is deprecated and should be avoided.</p> |
| <div class="example-wrap"><pre class="language-notrust"><code>abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1 |
| |-------------------------------| |
| | |
| authority</code></pre></div><h5 id="examples-7"><a href="#examples-7">Examples</a></h5> |
| <p>Absolute URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"http://example.org:80/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert_eq!</span>(uri.authority().map(|a| a.as_str()), <span class="prelude-val">Some</span>(<span class="string">"example.org:80"</span>));</code></pre></div> |
| <p>Relative URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert!</span>(uri.authority().is_none());</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/http/uri/mod.rs.html#590-592">source</a><h4 class="code-header">pub fn <a href="#method.host" class="fnname">host</a>(&self) -> Option<&str></h4></section></summary><div class="docblock"><p>Get the host of this <code>Uri</code>.</p> |
| <p>The host subcomponent of authority is identified by an IP literal |
| encapsulated within square brackets, an IPv4 address in dotted- decimal |
| form, or a registered name. The host subcomponent is <strong>case-insensitive</strong>.</p> |
| <div class="example-wrap"><pre class="language-notrust"><code>abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1 |
| |---------| |
| | |
| host</code></pre></div><h5 id="examples-8"><a href="#examples-8">Examples</a></h5> |
| <p>Absolute URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"http://example.org:80/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert_eq!</span>(uri.host(), <span class="prelude-val">Some</span>(<span class="string">"example.org"</span>));</code></pre></div> |
| <p>Relative URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert!</span>(uri.host().is_none());</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/http/uri/mod.rs.html#637-639">source</a><h4 class="code-header">pub fn <a href="#method.port" class="fnname">port</a>(&self) -> Option<<a class="struct" href="struct.Port.html" title="struct http::uri::Port">Port</a><&str>></h4></section></summary><div class="docblock"><p>Get the port part of this <code>Uri</code>.</p> |
| <p>The port subcomponent of authority is designated by an optional port |
| number following the host and delimited from it by a single colon (“:”) |
| character. It can be turned into a decimal port number with the <code>as_u16</code> |
| method or as a <code>str</code> with the <code>as_str</code> method.</p> |
| <div class="example-wrap"><pre class="language-notrust"><code>abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1 |
| |-| |
| | |
| port</code></pre></div><h5 id="examples-9"><a href="#examples-9">Examples</a></h5> |
| <p>Absolute URI with port</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"http://example.org:80/hello/world"</span>.parse().unwrap(); |
| |
| <span class="kw">let </span>port = uri.port().unwrap(); |
| <span class="macro">assert_eq!</span>(port.as_u16(), <span class="number">80</span>);</code></pre></div> |
| <p>Absolute URI without port</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"http://example.org/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert!</span>(uri.port().is_none());</code></pre></div> |
| <p>Relative URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert!</span>(uri.port().is_none());</code></pre></div> |
| </div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.port_u16" class="method has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#652-654">source</a><h4 class="code-header">pub fn <a href="#method.port_u16" class="fnname">port_u16</a>(&self) -> Option<u16></h4></section></summary><div class="docblock"><p>Get the port of this <code>Uri</code> as a <code>u16</code>.</p> |
| <h5 id="example-1"><a href="#example-1">Example</a></h5> |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"http://example.org:80/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert_eq!</span>(uri.port_u16(), <span class="prelude-val">Some</span>(<span class="number">80</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/http/uri/mod.rs.html#700-702">source</a><h4 class="code-header">pub fn <a href="#method.query" class="fnname">query</a>(&self) -> Option<&str></h4></section></summary><div class="docblock"><p>Get the query string of this <code>Uri</code>, starting after the <code>?</code>.</p> |
| <p>The query component contains non-hierarchical data that, along with data |
| in the path component, serves to identify a resource within the scope of |
| the URI’s scheme and naming authority (if any). The query component is |
| indicated by the first question mark (“?”) character and terminated by a |
| number sign (“#”) character or by the end of the URI.</p> |
| <div class="example-wrap"><pre class="language-notrust"><code>abc://username:password@example.com:123/path/data?key=value&key2=value2#fragid1 |
| |-------------------| |
| | |
| query</code></pre></div><h5 id="examples-10"><a href="#examples-10">Examples</a></h5> |
| <p>Absolute URI</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"http://example.org/hello/world?key=value"</span>.parse().unwrap(); |
| |
| <span class="macro">assert_eq!</span>(uri.query(), <span class="prelude-val">Some</span>(<span class="string">"key=value"</span>));</code></pre></div> |
| <p>Relative URI with a query string component</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"/hello/world?key=value&foo=bar"</span>.parse().unwrap(); |
| |
| <span class="macro">assert_eq!</span>(uri.query(), <span class="prelude-val">Some</span>(<span class="string">"key=value&foo=bar"</span>));</code></pre></div> |
| <p>Relative URI without a query string component</p> |
| |
| <div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">let </span>uri: Uri = <span class="string">"/hello/world"</span>.parse().unwrap(); |
| |
| <span class="macro">assert!</span>(uri.query().is_none());</code></pre></div> |
| </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-Clone-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#95">source</a><a href="#impl-Clone-for-Uri" class="anchor"></a><h3 class="code-header">impl Clone for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</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/http/uri/mod.rs.html#95">source</a><a href="#method.clone" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone</a>(&self) -> <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h4></section></summary><div class='docblock'>Returns a copy of the value. <a>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="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">clone_from</a>(&mut self, source: &Self)</h4></section></summary><div class='docblock'>Performs copy-assignment from <code>source</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Debug-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#1045-1049">source</a><a href="#impl-Debug-for-Uri" class="anchor"></a><h3 class="code-header">impl Debug for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><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/http/uri/mod.rs.html#1046-1048">source</a><a href="#method.fmt-1" class="anchor"></a><h4 class="code-header">fn <a class="fnname">fmt</a>(&self, f: &mut Formatter<'_>) -> Result</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Default-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#1014-1023">source</a><a href="#impl-Default-for-Uri" class="anchor"></a><h3 class="code-header">impl Default for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><div class="docblock"><p>Returns a <code>Uri</code> representing <code>/</code></p> |
| </div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.default" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#1016-1022">source</a><a href="#method.default" class="anchor"></a><h4 class="code-header">fn <a class="fnname">default</a>() -> <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h4></section></summary><div class='docblock'>Returns the “default value” for a type. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Display-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#1025-1043">source</a><a href="#impl-Display-for-Uri" class="anchor"></a><h3 class="code-header">impl Display for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><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/http/uri/mod.rs.html#1026-1042">source</a><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a class="fnname">fmt</a>(&self, f: &mut Formatter<'_>) -> Result</h4></section></summary><div class='docblock'>Formats the value using the given formatter. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-From%3CAuthority%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#773-781">source</a><a href="#impl-From%3CAuthority%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl From<<a class="struct" href="struct.Authority.html" title="struct http::uri::Authority">Authority</a>> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><div class="docblock"><p>Convert an <code>Authority</code> into a <code>Uri</code>.</p> |
| </div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#774-780">source</a><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(authority: <a class="struct" href="struct.Authority.html" title="struct http::uri::Authority">Authority</a>) -> Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-From%3CPathAndQuery%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#784-792">source</a><a href="#impl-From%3CPathAndQuery%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl From<<a class="struct" href="struct.PathAndQuery.html" title="struct http::uri::PathAndQuery">PathAndQuery</a>> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><div class="docblock"><p>Convert a <code>PathAndQuery</code> into a <code>Uri</code>.</p> |
| </div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#785-791">source</a><a href="#method.from-1" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(path_and_query: <a class="struct" href="struct.PathAndQuery.html" title="struct http::uri::PathAndQuery">PathAndQuery</a>) -> Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-From%3CUri%3E-for-Parts" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#795-821">source</a><a href="#impl-From%3CUri%3E-for-Parts" class="anchor"></a><h3 class="code-header">impl From<<a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>> for <a class="struct" href="struct.Parts.html" title="struct http::uri::Parts">Parts</a></h3></section></summary><div class="docblock"><p>Convert a <code>Uri</code> into <code>Parts</code></p> |
| </div><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#796-820">source</a><a href="#method.from-2" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(src: <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>) -> Self</h4></section></summary><div class='docblock'>Converts to this type from the input type.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-FromStr-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#883-890">source</a><a href="#impl-FromStr-for-Uri" class="anchor"></a><h3 class="code-header">impl FromStr for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><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 class="associatedtype">Err</a> = <a class="struct" href="struct.InvalidUri.html" title="struct http::uri::InvalidUri">InvalidUri</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/http/uri/mod.rs.html#887-889">source</a><a href="#method.from_str" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from_str</a>(s: &str) -> Result<<a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>, <a class="struct" href="struct.InvalidUri.html" title="struct http::uri::InvalidUri">InvalidUri</a>></h4></section></summary><div class='docblock'>Parses a string <code>s</code> to return a value of this type. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-Hash-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#1097-1118">source</a><a href="#impl-Hash-for-Uri" class="anchor"></a><h3 class="code-header">impl Hash for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><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/http/uri/mod.rs.html#1098-1117">source</a><a href="#method.hash" class="anchor"></a><h4 class="code-header">fn <a class="fnname">hash</a><H>(&self, state: &mut H)<span class="where fmt-newline">where<br> H: Hasher,</span></h4></section></summary><div class='docblock'>Feeds this value into the given [<code>Hasher</code>]. <a>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="since rightside" title="Stable since Rust version 1.3.0">1.3.0</span><a href="#method.hash_slice" class="anchor"></a><h4 class="code-header">fn <a class="fnname">hash_slice</a><H>(data: &[Self], state: &mut H)<span class="where fmt-newline">where<br> H: Hasher,</span></h4></section></summary><div class='docblock'>Feeds a slice of this type into the given [<code>Hasher</code>]. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3C%26%27a%20str%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#999-1003">source</a><a href="#impl-PartialEq%3C%26%27a%20str%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<'a> PartialEq<&'a str> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#1000-1002">source</a><a href="#method.eq-3" class="anchor"></a><h4 class="code-header">fn <a class="fnname">eq</a>(&self, other: &&'a str) -> bool</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>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ne-3" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.ne-3" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">ne</a>(&self, other: &Rhs) -> bool</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>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CUri%3E-for-%26%27a%20str" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#1005-1009">source</a><a href="#impl-PartialEq%3CUri%3E-for-%26%27a%20str" class="anchor"></a><h3 class="code-header">impl<'a> PartialEq<<a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>> for &'a str</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#1006-1008">source</a><a href="#method.eq-4" class="anchor"></a><h4 class="code-header">fn <a class="fnname">eq</a>(&self, uri: &<a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>) -> bool</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>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ne-4" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.ne-4" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">ne</a>(&self, other: &Rhs) -> bool</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>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CUri%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#892-912">source</a><a href="#impl-PartialEq%3CUri%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl PartialEq<<a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><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/http/uri/mod.rs.html#893-911">source</a><a href="#method.eq" class="anchor"></a><h4 class="code-header">fn <a class="fnname">eq</a>(&self, other: &<a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>) -> bool</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>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="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.ne" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">ne</a>(&self, other: &Rhs) -> bool</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>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3CUri%3E-for-str" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#993-997">source</a><a href="#impl-PartialEq%3CUri%3E-for-str" class="anchor"></a><h3 class="code-header">impl PartialEq<<a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>> for str</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#994-996">source</a><a href="#method.eq-2" class="anchor"></a><h4 class="code-header">fn <a class="fnname">eq</a>(&self, uri: &<a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>) -> bool</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>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ne-2" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.ne-2" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">ne</a>(&self, other: &Rhs) -> bool</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>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-PartialEq%3Cstr%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#914-991">source</a><a href="#impl-PartialEq%3Cstr%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl PartialEq<str> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.eq-1" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#915-990">source</a><a href="#method.eq-1" class="anchor"></a><h4 class="code-header">fn <a class="fnname">eq</a>(&self, other: &str) -> bool</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>Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><section id="method.ne-1" class="method trait-impl has-srclink"><span class="since rightside" title="Stable since Rust version 1.0.0">1.0.0</span><a href="#method.ne-1" class="anchor"></a><h4 class="code-header">const fn <a class="fnname">ne</a>(&self, other: &Rhs) -> bool</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>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-TryFrom%3C%26%27a%20%5Bu8%5D%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#709-716">source</a><a href="#impl-TryFrom%3C%26%27a%20%5Bu8%5D%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<'a> TryFrom<&'a [u8]> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</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 class="associatedtype">Error</a> = <a class="struct" href="struct.InvalidUri.html" title="struct http::uri::InvalidUri">InvalidUri</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/http/uri/mod.rs.html#713-715">source</a><a href="#method.try_from" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(t: &'a [u8]) -> Result<Self, Self::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-TryFrom%3C%26%27a%20String%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#727-734">source</a><a href="#impl-TryFrom%3C%26%27a%20String%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<'a> TryFrom<&'a String> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></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 class="associatedtype">Error</a> = <a class="struct" href="struct.InvalidUri.html" title="struct http::uri::InvalidUri">InvalidUri</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-2" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#731-733">source</a><a href="#method.try_from-2" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(t: &'a String) -> Result<Self, Self::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-TryFrom%3C%26%27a%20Uri%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#763-770">source</a><a href="#impl-TryFrom%3C%26%27a%20Uri%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<'a> TryFrom<&'a <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-6" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-6" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = <a class="struct" href="../struct.Error.html" title="struct http::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_from-6" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#767-769">source</a><a href="#method.try_from-6" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(src: &'a <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a>) -> Result<Self, Self::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-TryFrom%3C%26%27a%20str%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#718-725">source</a><a href="#impl-TryFrom%3C%26%27a%20str%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<'a> TryFrom<&'a str> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></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 class="associatedtype">Error</a> = <a class="struct" href="struct.InvalidUri.html" title="struct http::uri::InvalidUri">InvalidUri</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"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#722-724">source</a><a href="#method.try_from-1" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(t: &'a str) -> Result<Self, Self::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-TryFrom%3CParts%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#754-761">source</a><a href="#impl-TryFrom%3CParts%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl TryFrom<<a class="struct" href="struct.Parts.html" title="struct http::uri::Parts">Parts</a>> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-5" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-5" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = <a class="struct" href="struct.InvalidUriParts.html" title="struct http::uri::InvalidUriParts">InvalidUriParts</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-5" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#758-760">source</a><a href="#method.try_from-5" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(src: <a class="struct" href="struct.Parts.html" title="struct http::uri::Parts">Parts</a>) -> Result<Self, Self::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-TryFrom%3CString%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#736-743">source</a><a href="#impl-TryFrom%3CString%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl TryFrom<String> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-3" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-3" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = <a class="struct" href="struct.InvalidUri.html" title="struct http::uri::InvalidUri">InvalidUri</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-3" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#740-742">source</a><a href="#method.try_from-3" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(t: String) -> Result<Self, Self::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><section id="impl-TryFrom%3CVec%3Cu8%2C%20Global%3E%3E-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#745-752">source</a><a href="#impl-TryFrom%3CVec%3Cu8%2C%20Global%3E%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<'a> TryFrom<Vec<u8, Global>> for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-4" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-4" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = <a class="struct" href="struct.InvalidUri.html" title="struct http::uri::InvalidUri">InvalidUri</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-4" class="method trait-impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#749-751">source</a><a href="#method.try_from-4" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(vec: Vec<u8>) -> Result<Self, Self::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details><section id="impl-Eq-for-Uri" class="impl has-srclink"><a class="srclink rightside" href="../../src/http/uri/mod.rs.html#1011">source</a><a href="#impl-Eq-for-Uri" class="anchor"></a><h3 class="code-header">impl Eq for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</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-Uri" class="impl has-srclink"><a href="#impl-RefUnwindSafe-for-Uri" class="anchor"></a><h3 class="code-header">impl RefUnwindSafe for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section><section id="impl-Send-for-Uri" class="impl has-srclink"><a href="#impl-Send-for-Uri" class="anchor"></a><h3 class="code-header">impl Send for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section><section id="impl-Sync-for-Uri" class="impl has-srclink"><a href="#impl-Sync-for-Uri" class="anchor"></a><h3 class="code-header">impl Sync for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section><section id="impl-Unpin-for-Uri" class="impl has-srclink"><a href="#impl-Unpin-for-Uri" class="anchor"></a><h3 class="code-header">impl Unpin for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</a></h3></section><section id="impl-UnwindSafe-for-Uri" class="impl has-srclink"><a href="#impl-UnwindSafe-for-Uri" class="anchor"></a><h3 class="code-header">impl UnwindSafe for <a class="struct" href="struct.Uri.html" title="struct http::uri::Uri">Uri</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-Uri" class="impl has-srclink"><a href="#impl-Any-for-Uri" class="anchor"></a><h3 class="code-header">impl<T> Any for T<span class="where fmt-newline">where<br> T: 'static + ?Sized,</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 href="#method.type_id" class="anchor"></a><h4 class="code-header">fn <a class="fnname">type_id</a>(&self) -> TypeId</h4></section></summary><div class='docblock'>Gets the <code>TypeId</code> of <code>self</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-Borrow%3CT%3E-for-Uri" class="impl has-srclink"><a href="#impl-Borrow%3CT%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<T> Borrow<T> for T<span class="where fmt-newline">where<br> T: ?Sized,</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="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow</a>(&self) -> &T</h4></section></summary><div class='docblock'>Immutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-BorrowMut%3CT%3E-for-Uri" class="impl has-srclink"><a href="#impl-BorrowMut%3CT%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<T> BorrowMut<T> for T<span class="where fmt-newline">where<br> T: ?Sized,</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="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/91522" title="Tracking issue for const_borrow">unstable</a></span><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">fn <a class="fnname">borrow_mut</a>(&mut self) -> &mut T</h4></section></summary><div class='docblock'>Mutably borrows from an owned value. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-From%3CT%3E-for-Uri" class="impl has-srclink"><a href="#impl-From%3CT%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<T> From<T> for T</h3></section></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><section id="method.from-3" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.from-3" class="anchor"></a><h4 class="code-header">fn <a class="fnname">from</a>(t: T) -> 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-Into%3CU%3E-for-Uri" class="impl has-srclink"><a href="#impl-Into%3CU%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<T, U> Into<U> for T<span class="where fmt-newline">where<br> U: From<T>,</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="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">into</a>(self) -> 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>[From]<T> for U</code> chooses to do.</p> |
| </div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToOwned-for-Uri" class="impl has-srclink"><a href="#impl-ToOwned-for-Uri" class="anchor"></a><h3 class="code-header">impl<T> ToOwned for T<span class="where fmt-newline">where<br> T: Clone,</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 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 href="#method.to_owned" class="anchor"></a><h4 class="code-header">fn <a class="fnname">to_owned</a>(&self) -> T</h4></section></summary><div class='docblock'>Creates owned data from borrowed data, usually by cloning. <a>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 href="#method.clone_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">clone_into</a>(&self, target: &mut T)</h4></section></summary><div class='docblock'>Uses borrowed data to replace owned data, usually by cloning. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ToString-for-Uri" class="impl has-srclink"><a href="#impl-ToString-for-Uri" class="anchor"></a><h3 class="code-header">impl<T> ToString for T<span class="where fmt-newline">where<br> T: Display + ?Sized,</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 href="#method.to_string" class="anchor"></a><h4 class="code-header">default fn <a class="fnname">to_string</a>(&self) -> String</h4></section></summary><div class='docblock'>Converts the given value to a <code>String</code>. <a>Read more</a></div></details></div></details><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-TryFrom%3CU%3E-for-Uri" class="impl has-srclink"><a href="#impl-TryFrom%3CU%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<T, U> TryFrom<U> for T<span class="where fmt-newline">where<br> U: Into<T>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-8" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-8" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = Infallible</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-7" class="method trait-impl has-srclink"><span class="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_from-7" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_from</a>(value: U) -> Result<T, <T as TryFrom<U>>::Error></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-Uri" class="impl has-srclink"><a href="#impl-TryInto%3CU%3E-for-Uri" class="anchor"></a><h3 class="code-header">impl<T, U> TryInto<U> for T<span class="where fmt-newline">where<br> U: TryFrom<T>,</span></h3></section></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><section id="associatedtype.Error-7" class="associatedtype trait-impl has-srclink"><a href="#associatedtype.Error-7" class="anchor"></a><h4 class="code-header">type <a class="associatedtype">Error</a> = <U as TryFrom<T>>::Error</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="since rightside" title="const unstable">const: <a href="https://github.com/rust-lang/rust/issues/88674" title="Tracking issue for const_convert">unstable</a></span><a href="#method.try_into" class="anchor"></a><h4 class="code-header">fn <a class="fnname">try_into</a>(self) -> Result<U, <U as TryFrom<T>>::Error></h4></section></summary><div class='docblock'>Performs the conversion.</div></details></div></details></div></section></div></main><div id="rustdoc-vars" data-root-path="../../" data-current-crate="http" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.66.0-nightly (5c8bff74b 2022-10-21)" ></div></body></html> |