blob: f644efb7d3c9b3bdc92e7972dfc768db46889c80 [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="URI component of request and response lines"><meta name="keywords" content="rust, rustlang, rust-lang, uri"><title>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="../../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 mod"><!--[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="../../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="#">Module uri</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li></ul></section></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">Module <a href="../index.html">http</a>::<wbr><a class="mod" 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#1-1118">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>URI component of request and response lines</p>
<p>This module primarily contains the <code>Uri</code> type which is a component of all
HTTP requests and also reexports this type at the root of the crate. A URI
is not always a “full URL” in the sense of something you’d type into a web
browser, but HTTP requests may only have paths on servers but may have full
schemes and hostnames on clients.</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">&quot;/foo/bar?baz&quot;</span>.parse::&lt;Uri&gt;().unwrap();
<span class="macro">assert_eq!</span>(uri.path(), <span class="string">&quot;/foo/bar&quot;</span>);
<span class="macro">assert_eq!</span>(uri.query(), <span class="prelude-val">Some</span>(<span class="string">&quot;baz&quot;</span>));
<span class="macro">assert_eq!</span>(uri.host(), <span class="prelude-val">None</span>);
<span class="kw">let </span>uri = <span class="string">&quot;https://www.rust-lang.org/install.html&quot;</span>.parse::&lt;Uri&gt;().unwrap();
<span class="macro">assert_eq!</span>(uri.scheme_str(), <span class="prelude-val">Some</span>(<span class="string">&quot;https&quot;</span>));
<span class="macro">assert_eq!</span>(uri.host(), <span class="prelude-val">Some</span>(<span class="string">&quot;www.rust-lang.org&quot;</span>));
<span class="macro">assert_eq!</span>(uri.path(), <span class="string">&quot;/install.html&quot;</span>);</code></pre></div>
</div></details><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Authority.html" title="http::uri::Authority struct">Authority</a></div><div class="item-right docblock-short">Represents the authority component of a URI.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Builder.html" title="http::uri::Builder struct">Builder</a></div><div class="item-right docblock-short">A builder for <code>Uri</code>s.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.InvalidUri.html" title="http::uri::InvalidUri struct">InvalidUri</a></div><div class="item-right docblock-short">An error resulting from a failed attempt to construct a URI.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.InvalidUriParts.html" title="http::uri::InvalidUriParts struct">InvalidUriParts</a></div><div class="item-right docblock-short">An error resulting from a failed attempt to construct a URI.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Parts.html" title="http::uri::Parts struct">Parts</a></div><div class="item-right docblock-short">The various parts of a URI.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.PathAndQuery.html" title="http::uri::PathAndQuery struct">PathAndQuery</a></div><div class="item-right docblock-short">Represents the path component of a URI</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Port.html" title="http::uri::Port struct">Port</a></div><div class="item-right docblock-short">The port component of a URI.</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Scheme.html" title="http::uri::Scheme struct">Scheme</a></div><div class="item-right docblock-short">Represents the scheme component of a URI</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Uri.html" title="http::uri::Uri struct">Uri</a></div><div class="item-right docblock-short">The URI component of a request.</div></div></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>