mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-30 18:44:35 +01:00
19 lines
6.6 KiB
HTML
19 lines
6.6 KiB
HTML
|
<!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"><title>actix_http::uri - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="actix_http" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../../static.files/storage-118b08c4c78b968e.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></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" title="show sidebar"></button><a class="logo-container" href="../../actix_http/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../actix_http/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../../actix_http/index.html">actix_http</a><span class="version">3.7.0</span></h2></div><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><h2><a href="../index.html">In crate actix_http</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../index.html">actix_http</a>::<wbr><a class="mod" href="#">uri</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="https://docs.rs/http/0.2.11/src/http/lib.rs.html#178">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><details class="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 class="doc-anchor" href="#examples">§</a>Examples</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="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><ul class="item-table"><li><div class="item-name"><a class="struct" href="struct.Authority.html" title="struct actix_http::uri::Authority">Authority</a></div><div class="desc docblock-short">Represents the authority component of a URI.</div></li><li><div class="item-name"><a class="struct" href="struct.Builder.html" title="struct actix_http::uri::Builder">Builder</a></div><div class="desc docblock-short">A builder for <code>Uri</code>s.</div></li><li><div class="item-name"><a class="struct" href="struct.InvalidUri.html" title="struct actix_http::uri::InvalidUri">InvalidUri</a></div><div class="desc docblock-short">An error resulting from a failed attempt to construct a URI.</div></li><li><div class="item-name"><a class="struct" href="struct.InvalidUriParts.html" title="struct actix_http::uri::InvalidUriParts">InvalidUriParts</a></div><div class="desc docblock-short">An error resulting from a failed attempt to construct a URI.</div></li><li><div class="item-name"><a class="struct" href="struct.Parts.html" title="struct actix_http::uri::Parts">Parts</a></div><div class="desc docblock-short">The various parts of a URI.</div></li><li><div class="item-name"><a class="struct" href="struct.PathAndQuery.html" title="struct actix_http::uri::PathAndQuery">PathAndQuery</a></div><div class="desc docblock-short">Represents the path component of a URI</div></li><li><div class="item-name"><a class="struct" href="struct.Port.html" title="struct actix_http::uri::Port">Port</a></div><div class="desc docblock-short">The port component of a URI.</div></li><li><div class="item-name"><a class="struct" href="struct.Scheme.html" title="struct actix_http::uri::Scheme">Scheme</a></div><div class="desc docblock-short">Represents the scheme component of a URI</div></li><li><div class="item-name"><a class="struct" href="struct.Uri.html" title="struct actix_http::uri::Uri">Uri</a></div><div class="desc docblock-short">The URI component of a request.</div></li></ul></section></div></main></body></html>
|