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

177 lines
No EOL
18 KiB
HTML
Raw Permalink 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 `Response` struct in crate `hyper`.">
<meta name="keywords" content="rust, rustlang, rust-lang, Response">
<title>hyper::Response - 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 Response</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.version">version</a><a href="#method.headers">headers</a><a href="#method.headers_mut">headers_mut</a><a href="#method.status">status</a><a href="#method.set_status">set_status</a><a href="#method.with_status">with_status</a><a href="#method.with_header">with_header</a><a href="#method.with_headers">with_headers</a><a href="#method.set_body">set_body</a><a href="#method.with_body">with_body</a><a href="#method.body_ref">body_ref</a><a href="#method.body">body</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Default">Default</a><a href="#impl-Debug">Debug</a><a href="#impl-Into%3CMessage%3C__ProtoResponse%2C%20B%3E%3E">Into&lt;Message&lt;__ProtoResponse, B&gt;&gt;</a></div></div><p class='location'><a href='index.html'>hyper</a></p><script>window.sidebarCurrent = {name: 'Response', 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 class="struct" href=''>Response</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/response.rs.html#14-21' title='goto source code'>[src]</a></span></h1>
<pre class='rust struct'>pub struct Response&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 Response</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.Response.html" title="struct hyper::Response">Response</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/response.rs.html#23-107' 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>() -&gt; <a class="struct" href="../hyper/struct.Response.html" title="struct hyper::Response">Response</a>&lt;B&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/hyper/proto/response.rs.html#26-28' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Constructs a default response</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/response.rs.html#32' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Get the HTTP version of this response.</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/response.rs.html#36' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Get the headers from the response.</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/response.rs.html#40' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Get a mutable reference to the headers.</p>
</div><h4 id='method.status' class="method"><span id='status.v' class='invisible'><code>pub fn <a href='#method.status' class='fnname'>status</a>(&amp;self) -&gt; <a class="enum" href="../hyper/enum.StatusCode.html" title="enum hyper::StatusCode">StatusCode</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/hyper/proto/response.rs.html#44' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Get the status from the server.</p>
</div><h4 id='method.set_status' class="method"><span id='set_status.v' class='invisible'><code>pub fn <a href='#method.set_status' class='fnname'>set_status</a>(&amp;mut self, status: <a class="enum" href="../hyper/enum.StatusCode.html" title="enum hyper::StatusCode">StatusCode</a>)</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/hyper/proto/response.rs.html#56-58' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set the <code>StatusCode</code> for this response.</p>
</div><h4 id='method.with_status' class="method"><span id='with_status.v' class='invisible'><code>pub fn <a href='#method.with_status' class='fnname'>with_status</a>(self, status: <a class="enum" href="../hyper/enum.StatusCode.html" title="enum hyper::StatusCode">StatusCode</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/hyper/proto/response.rs.html#64-67' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set the status and move the Response.</p>
<p>Useful for the &quot;builder-style&quot; pattern.</p>
</div><h4 id='method.with_header' class="method"><span id='with_header.v' class='invisible'><code>pub fn <a href='#method.with_header' class='fnname'>with_header</a>&lt;H:&nbsp;<a class="trait" href="../hyper/header/trait.Header.html" title="trait hyper::header::Header">Header</a>&gt;(self, header: H) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/hyper/proto/response.rs.html#73-76' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set a header and move the Response.</p>
<p>Useful for the &quot;builder-style&quot; pattern.</p>
</div><h4 id='method.with_headers' class="method"><span id='with_headers.v' class='invisible'><code>pub fn <a href='#method.with_headers' class='fnname'>with_headers</a>(self, headers: <a class="struct" href="../hyper/header/struct.Headers.html" title="struct hyper::header::Headers">Headers</a>) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/hyper/proto/response.rs.html#82-85' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set the headers and move the Response.</p>
<p>Useful for the &quot;builder-style&quot; pattern.</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/response.rs.html#89-91' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set the body.</p>
</div><h4 id='method.with_body' class="method"><span id='with_body.v' class='invisible'><code>pub fn <a href='#method.with_body' class='fnname'>with_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;(self, body: T) -&gt; Self</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/hyper/proto/response.rs.html#97-100' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Set the body and move the Response.</p>
<p>Useful for the &quot;builder-style&quot; pattern.</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/response.rs.html#104' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Read the body.</p>
</div></div><h3 id='impl-1' class='impl'><span class='in-band'><code>impl <a class="struct" href="../hyper/struct.Response.html" title="struct hyper::Response">Response</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/response.rs.html#109-115' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><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/response.rs.html#112-114' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Take the <code>Body</code> of this response.</p>
</div></div>
<h2 id='implementations' class='small-section-header'>
Trait Implementations<a href='#implementations' class='anchor'></a>
</h2>
<h3 id='impl-Default' class='impl'><span class='in-band'><code>impl&lt;B&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="struct" href="../hyper/struct.Response.html" title="struct hyper::Response">Response</a>&lt;B&gt;</code><a href='#impl-Default' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/hyper/proto/response.rs.html#118-127' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.default' class="method"><span id='default.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default' class='fnname'>default</a>() -&gt; <a class="struct" href="../hyper/struct.Response.html" title="struct hyper::Response">Response</a>&lt;B&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/hyper/proto/response.rs.html#119-126' title='goto source code'>[src]</a></span></h4>
<div class='docblock'><p>Returns the &quot;default value&quot; for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
</div></div><h3 id='impl-Debug' class='impl'><span class='in-band'><code>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="../hyper/struct.Response.html" title="struct hyper::Response">Response</a></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/response.rs.html#142-150' 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/response.rs.html#143-149' 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-Into%3CMessage%3C__ProtoResponse%2C%20B%3E%3E' class='impl'><span class='in-band'><code>impl&lt;B&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;<a class="enum" href="../tokio_proto/streaming/message/enum.Message.html" title="enum tokio_proto::streaming::message::Message">Message</a>&lt;__ProtoResponse, B&gt;&gt; for <a class="struct" href="../hyper/struct.Response.html" title="struct hyper::Response">Response</a>&lt;B&gt;</code><a href='#impl-Into%3CMessage%3C__ProtoResponse%2C%20B%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#223-233' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.into' class="method"><span id='into.v' class='invisible'><code>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into' class='fnname'>into</a>(self) -&gt; <a class="enum" href="../tokio_proto/streaming/message/enum.Message.html" title="enum tokio_proto::streaming::message::Message">Message</a>&lt;__ProtoResponse, B&gt;</code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/hyper/server/server_proto.rs.html#225-232' 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>