mentat/hyper/server/struct.Request.html
2018-08-22 17:04:13 +00:00

184 lines
No EOL
21 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="rustdoc">
<meta name="description" content="API documentation for the Rust `Request` struct in crate `hyper`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Request">
<title>hyper::server::Request - Rust</title>
<link rel="stylesheet" type="text/css" href="../../normalize.css">
<link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle">
<link rel="stylesheet" type="text/css" href="../../dark.css">
<link rel="stylesheet" type="text/css" href="../../main.css" id="themeStyle">
<script src="../../storage.js"></script>
</head>
<body class="rustdoc struct">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<div class="sidebar-menu">&#9776;</div>
<p class='location'>Struct Request</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a><a href="#method.uri">uri</a><a href="#method.version">version</a><a href="#method.headers">headers</a><a href="#method.method">method</a><a href="#method.body_ref">body_ref</a><a href="#method.body_mut">body_mut</a><a href="#method.path">path</a><a href="#method.query">query</a><a href="#method.set_method">set_method</a><a href="#method.headers_mut">headers_mut</a><a href="#method.set_uri">set_uri</a><a href="#method.set_version">set_version</a><a href="#method.set_body">set_body</a><a href="#method.set_proxy">set_proxy</a><a href="#method.deconstruct">deconstruct</a><a href="#method.body">body</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-From%3CMessage%3C__ProtoRequest%2C%20Body%3CChunk%2C%20Error%3E%3E%3E">From&lt;Message&lt;__ProtoRequest, Body&lt;Chunk, Error&gt;&gt;&gt;</a></div></div><p class='location'><a href='../index.html'>hyper</a>::<wbr><a href='index.html'>server</a></p><script>window.sidebarCurrent = {name: 'Request', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div>
</nav>
<div class="theme-picker">
<button id="theme-picker" aria-label="Pick another theme!">
<img src="../../brush.svg" width="18" alt="Pick another theme!">
</button>
<div id="theme-choices"></div>
</div>
<script src="../../theme.js"></script>
<nav class="sub">
<form class="search-form js-only">
<div class="search-container">
<input class="search-input" name="search"
autocomplete="off"
placeholder="Click or press S to search, ? for more options…"
type="search">
</div>
</form>
</nav>
<section id='main' class="content">
<h1 class='fqn'><span class='in-band'>Struct <a href='../index.html'>hyper</a>::<wbr><a href='index.html'>server</a>::<wbr><a class="struct" href=''>Request</a></span><span class='out-of-band'><span id='render-detail'>
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
[<span class='inner'>&#x2212;</span>]
</a>
</span><a class='srclink' href='../../src/hyper/proto/request.rs.html#16-24' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Request&lt;B&nbsp;=&nbsp;<a class="struct" href="../../hyper/struct.Body.html" title="struct hyper::Body">Body</a>&gt; { /* fields omitted */ }</pre><div class='docblock'><p>An HTTP Request</p>
</div>
<h2 id='methods' class='small-section-header'>
Methods<a href='#methods' class='anchor'></a>
</h2>
<h3 id='impl' class='impl'><span class='in-band'><code>impl&lt;B&gt; <a class="struct" href="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a>&lt;B&gt;</code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#26-114' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.new' class="method"><span id='new.v' class='invisible'><code>pub fn <a href='#method.new' class='fnname'>new</a>(method: <a class="enum" href="../../hyper/enum.Method.html" title="enum hyper::Method">Method</a>, uri: <a class="struct" href="../../hyper/struct.Uri.html" title="struct hyper::Uri">Uri</a>) -&gt; <a class="struct" href="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a>&lt;B&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#29-39' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Construct a new Request.</p>
</div><h4 id='method.uri' class="method"><span id='uri.v' class='invisible'><code>pub fn <a href='#method.uri' class='fnname'>uri</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../hyper/struct.Uri.html" title="struct hyper::Uri">Uri</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#43' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Read the Request Uri.</p>
</div><h4 id='method.version' class="method"><span id='version.v' class='invisible'><code>pub fn <a href='#method.version' class='fnname'>version</a>(&amp;self) -&gt; <a class="enum" href="../../hyper/enum.HttpVersion.html" title="enum hyper::HttpVersion">HttpVersion</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#47' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Read the Request Version.</p>
</div><h4 id='method.headers' class="method"><span id='headers.v' class='invisible'><code>pub fn <a href='#method.headers' class='fnname'>headers</a>(&amp;self) -&gt; &amp;<a class="struct" href="../../hyper/header/struct.Headers.html" title="struct hyper::header::Headers">Headers</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#51' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Read the Request headers.</p>
</div><h4 id='method.method' class="method"><span id='method.v' class='invisible'><code>pub fn <a href='#method.method' class='fnname'>method</a>(&amp;self) -&gt; &amp;<a class="enum" href="../../hyper/enum.Method.html" title="enum hyper::Method">Method</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#55' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Read the Request method.</p>
</div><h4 id='method.body_ref' class="method"><span id='body_ref.v' class='invisible'><code>pub fn <a href='#method.body_ref' class='fnname'>body_ref</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.reference.html">&amp;</a>B&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#59' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Read the Request body.</p>
</div><h4 id='method.body_mut' class="method"><span id='body_mut.v' class='invisible'><code>pub fn <a href='#method.body_mut' class='fnname'>body_mut</a>(&amp;mut self) -&gt; &amp;mut <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;B&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#63' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Get a mutable reference to the Request body.</p>
</div><h4 id='method.path' class="method"><span id='path.v' class='invisible'><code>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></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#72-74' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>The target path of this Request.</p>
</div><h4 id='method.query' class="method"><span id='query.v' class='invisible'><code>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;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#78-80' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>The query string of this Request.</p>
</div><h4 id='method.set_method' class="method"><span id='set_method.v' class='invisible'><code>pub fn <a href='#method.set_method' class='fnname'>set_method</a>(&amp;mut self, method: <a class="enum" href="../../hyper/enum.Method.html" title="enum hyper::Method">Method</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#84' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set the Method of this request.</p>
</div><h4 id='method.headers_mut' class="method"><span id='headers_mut.v' class='invisible'><code>pub fn <a href='#method.headers_mut' class='fnname'>headers_mut</a>(&amp;mut self) -&gt; &amp;mut <a class="struct" href="../../hyper/header/struct.Headers.html" title="struct hyper::header::Headers">Headers</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#88' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Get a mutable reference to the Request headers.</p>
</div><h4 id='method.set_uri' class="method"><span id='set_uri.v' class='invisible'><code>pub fn <a href='#method.set_uri' class='fnname'>set_uri</a>(&amp;mut self, uri: <a class="struct" href="../../hyper/struct.Uri.html" title="struct hyper::Uri">Uri</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#92' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set the <code>Uri</code> of this request.</p>
</div><h4 id='method.set_version' class="method"><span id='set_version.v' class='invisible'><code>pub fn <a href='#method.set_version' class='fnname'>set_version</a>(&amp;mut self, version: <a class="enum" href="../../hyper/enum.HttpVersion.html" title="enum hyper::HttpVersion">HttpVersion</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#96' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set the <code>HttpVersion</code> of this request.</p>
</div><h4 id='method.set_body' class="method"><span id='set_body.v' class='invisible'><code>pub fn <a href='#method.set_body' class='fnname'>set_body</a>&lt;T:&nbsp;<a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;B&gt;&gt;(&amp;mut self, body: T)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#104' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set the body of the request.</p>
<p>By default, the body will be sent using <code>Transfer-Encoding: chunked</code>. To
override this behavior, manually set a [<code>ContentLength</code>] header with the
length of <code>body</code>.</p>
</div><h4 id='method.set_proxy' class="method"><span id='set_proxy.v' class='invisible'><code>pub fn <a href='#method.set_proxy' class='fnname'>set_proxy</a>(&amp;mut self, is_proxy: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#111' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set that the URI should use the absolute form.</p>
<p>This is only needed when talking to HTTP/1 proxies to URLs not
protected by TLS.</p>
</div></div><h3 id='impl-1' class='impl'><span class='in-band'><code>impl <a class="struct" href="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a>&lt;<a class="struct" href="../../hyper/struct.Body.html" title="struct hyper::Body">Body</a>&gt;</code><a href='#impl-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#116-128' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.deconstruct' class="method"><span id='deconstruct.v' class='invisible'><code>pub fn <a href='#method.deconstruct' class='fnname'>deconstruct</a>(self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="enum" href="../../hyper/enum.Method.html" title="enum hyper::Method">Method</a>, <a class="struct" href="../../hyper/struct.Uri.html" title="struct hyper::Uri">Uri</a>, <a class="enum" href="../../hyper/enum.HttpVersion.html" title="enum hyper::HttpVersion">HttpVersion</a>, <a class="struct" href="../../hyper/header/struct.Headers.html" title="struct hyper::header::Headers">Headers</a>, <a class="struct" href="../../hyper/struct.Body.html" title="struct hyper::Body">Body</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#121-123' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Deconstruct this Request into its pieces.</p>
<p>Modifying these pieces will have no effect on how hyper behaves.</p>
</div><h4 id='method.body' class="method"><span id='body.v' class='invisible'><code>pub fn <a href='#method.body' class='fnname'>body</a>(self) -&gt; <a class="struct" href="../../hyper/struct.Body.html" title="struct hyper::Body">Body</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#127' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Take the Request body.</p>
</div></div>
<h2 id='implementations' class='small-section-header'>
Trait Implementations<a href='#implementations' class='anchor'></a>
</h2>
<h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl&lt;B&gt; <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="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a>&lt;B&gt;</code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#130-140' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.fmt' class="method"><span id='fmt.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/proto/request.rs.html#131-139' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>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></p>
</div></div><h3 id='impl-From%3CMessage%3C__ProtoRequest%2C%20Body%3CChunk%2C%20Error%3E%3E%3E' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;<a class="enum" href="../../tokio_proto/streaming/message/enum.Message.html" title="enum tokio_proto::streaming::message::Message">Message</a>&lt;__ProtoRequest, <a class="struct" href="../../tokio_proto/streaming/body/struct.Body.html" title="struct tokio_proto::streaming::body::Body">Body</a>&lt;<a class="struct" href="../../hyper/struct.Chunk.html" title="struct hyper::Chunk">Chunk</a>, <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt;&gt;&gt; for <a class="struct" href="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a></code><a href='#impl-From%3CMessage%3C__ProtoRequest%2C%20Body%3CChunk%2C%20Error%3E%3E%3E' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/server_proto.rs.html#212-221' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.from' class="method"><span id='from.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(message: <a class="enum" href="../../tokio_proto/streaming/message/enum.Message.html" title="enum tokio_proto::streaming::message::Message">Message</a>&lt;__ProtoRequest, <a class="struct" href="../../tokio_proto/streaming/body/struct.Body.html" title="struct tokio_proto::streaming::body::Body">Body</a>&lt;<a class="struct" href="../../hyper/struct.Chunk.html" title="struct hyper::Chunk">Chunk</a>, <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>&gt;&gt;) -&gt; <a class="struct" href="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/hyper/server/server_proto.rs.html#214-220' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Performs the conversion.</p>
</div></div></section>
<section id='search' class="content hidden"></section>
<section class="footer"></section>
<aside id="help" class="hidden">
<div>
<h1 class="hidden">Help</h1>
<div class="shortcuts">
<h2>Keyboard Shortcuts</h2>
<dl>
<dt><kbd>?</kbd></dt>
<dd>Show this help dialog</dd>
<dt><kbd>S</kbd></dt>
<dd>Focus the search field</dd>
<dt><kbd></kbd></dt>
<dd>Move up in search results</dd>
<dt><kbd></kbd></dt>
<dd>Move down in search results</dd>
<dt><kbd></kbd></dt>
<dd>Switch tab</dd>
<dt><kbd>&#9166;</kbd></dt>
<dd>Go to active search result</dd>
<dt><kbd>+</kbd></dt>
<dd>Expand all sections</dd>
<dt><kbd>-</kbd></dt>
<dd>Collapse all sections</dd>
</dl>
</div>
<div class="infos">
<h2>Search Tricks</h2>
<p>
Prefix searches with a type followed by a colon (e.g.
<code>fn:</code>) to restrict the search to a given type.
</p>
<p>
Accepted types are: <code>fn</code>, <code>mod</code>,
<code>struct</code>, <code>enum</code>,
<code>trait</code>, <code>type</code>, <code>macro</code>,
and <code>const</code>.
</p>
<p>
Search functions by type signature (e.g.
<code>vec -> usize</code> or <code>* -> vec</code>)
</p>
</div>
</div>
</aside>
<script>
window.rootPath = "../../";
window.currentCrate = "hyper";
</script>
<script src="../../main.js"></script>
<script defer src="../../search-index.js"></script>
</body>
</html>