juniper/hyper/http/message/trait.HttpMessage.html

162 lines
16 KiB
HTML
Raw Normal View History

2016-09-11 13:41:24 -05:00
<!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 `HttpMessage` trait in crate `hyper`.">
<meta name="keywords" content="rust, rustlang, rust-lang, HttpMessage">
<title>hyper::http::message::HttpMessage - Rust</title>
<link rel="stylesheet" type="text/css" href="../../../rustdoc.css">
<link rel="stylesheet" type="text/css" href="../../../main.css">
</head>
<body class="rustdoc">
<!--[if lte IE 8]>
<div class="warning">
This old browser is unsupported and will most likely display funky
things.
</div>
<![endif]-->
<nav class="sidebar">
<p class='location'><a href='../../index.html'>hyper</a>::<wbr><a href='../index.html'>http</a>::<wbr><a href='index.html'>message</a></p><script>window.sidebarCurrent = {name: 'HttpMessage', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script>
</nav>
<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 trait">
<h1 class='fqn'><span class='in-band'>Trait <a href='../../index.html'>hyper</a>::<wbr><a href='../index.html'>http</a>::<wbr><a href='index.html'>message</a>::<wbr><a class='trait' href=''>HttpMessage</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 id='src-6625' class='srclink' href='../../../src/hyper/http/message.rs.html#52-78' title='goto source code'>[src]</a></span></h1>
<pre class='rust trait'>pub trait HttpMessage: <a class='trait' href='https://doc.rust-lang.org/nightly/std/io/trait.Write.html' title='std::io::Write'>Write</a> + <a class='trait' href='https://doc.rust-lang.org/nightly/std/io/trait.Read.html' title='std::io::Read'>Read</a> + <a class='trait' href='https://doc.rust-lang.org/nightly/core/marker/trait.Send.html' title='core::marker::Send'>Send</a> + <a class='trait' href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html' title='core::any::Any'>Any</a> + <a class='trait' href='../../../typeable/trait.Typeable.html' title='typeable::Typeable'>Typeable</a> + <a class='trait' href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html' title='core::fmt::Debug'>Debug</a> {
fn <a href='#tymethod.set_outgoing' class='fnname'>set_outgoing</a>(&amp;mut self, head: <a class='struct' href='../../../hyper/http/message/struct.RequestHead.html' title='hyper::http::message::RequestHead'>RequestHead</a>) -&gt; <a class='type' href='../../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a>&lt;<a class='struct' href='../../../hyper/http/message/struct.RequestHead.html' title='hyper::http::message::RequestHead'>RequestHead</a>&gt;;
fn <a href='#tymethod.get_incoming' class='fnname'>get_incoming</a>(&amp;mut self) -&gt; <a class='type' href='../../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a>&lt;<a class='struct' href='../../../hyper/http/message/struct.ResponseHead.html' title='hyper::http::message::ResponseHead'>ResponseHead</a>&gt;;
fn <a href='#tymethod.set_read_timeout' class='fnname'>set_read_timeout</a>(&amp;self, dur: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html' title='std::time::duration::Duration'>Duration</a>&gt;) -&gt; <a class='type' href='https://doc.rust-lang.org/nightly/std/io/error/type.Result.html' title='std::io::error::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;;
fn <a href='#tymethod.set_write_timeout' class='fnname'>set_write_timeout</a>(&amp;self, dur: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html' title='std::time::duration::Duration'>Duration</a>&gt;) -&gt; <a class='type' href='https://doc.rust-lang.org/nightly/std/io/error/type.Result.html' title='std::io::error::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;;
fn <a href='#tymethod.close_connection' class='fnname'>close_connection</a>(&amp;mut self) -&gt; <a class='type' href='../../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;;
fn <a href='#tymethod.has_body' class='fnname'>has_body</a>(&amp;self) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>;
fn <a href='#method.set_proxied' class='fnname'>set_proxied</a>(&amp;mut self, val: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>) { ... }
}</pre><div class='docblock'><p>The trait provides an API for sending an receiving HTTP messages.</p>
</div>
<h2 id='required-methods'>Required Methods</h2>
<div class='methods'>
<h3 id='tymethod.set_outgoing' class='method stab '><code>fn <a href='#tymethod.set_outgoing' class='fnname'>set_outgoing</a>(&amp;mut self, head: <a class='struct' href='../../../hyper/http/message/struct.RequestHead.html' title='hyper::http::message::RequestHead'>RequestHead</a>) -&gt; <a class='type' href='../../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a>&lt;<a class='struct' href='../../../hyper/http/message/struct.RequestHead.html' title='hyper::http::message::RequestHead'>RequestHead</a>&gt;</code></h3><div class='docblock'><p>Initiates a new outgoing request.</p>
<p>Only the request&#39;s head is provided (in terms of the <code>RequestHead</code> struct).</p>
<p>After this, the <code>HttpMessage</code> instance can be used as an <code>io::Write</code> in order to write the
body of the request.</p>
</div><h3 id='tymethod.get_incoming' class='method stab '><code>fn <a href='#tymethod.get_incoming' class='fnname'>get_incoming</a>(&amp;mut self) -&gt; <a class='type' href='../../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a>&lt;<a class='struct' href='../../../hyper/http/message/struct.ResponseHead.html' title='hyper::http::message::ResponseHead'>ResponseHead</a>&gt;</code></h3><div class='docblock'><p>Obtains the incoming response and returns its head (i.e. the <code>ResponseHead</code> struct)</p>
<p>After this, the <code>HttpMessage</code> instance can be used as an <code>io::Read</code> in order to read out
the response body.</p>
</div><h3 id='tymethod.set_read_timeout' class='method stab '><code>fn <a href='#tymethod.set_read_timeout' class='fnname'>set_read_timeout</a>(&amp;self, dur: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html' title='std::time::duration::Duration'>Duration</a>&gt;) -&gt; <a class='type' href='https://doc.rust-lang.org/nightly/std/io/error/type.Result.html' title='std::io::error::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h3><div class='docblock'><p>Set the read timeout duration for this message.</p>
</div><h3 id='tymethod.set_write_timeout' class='method stab '><code>fn <a href='#tymethod.set_write_timeout' class='fnname'>set_write_timeout</a>(&amp;self, dur: <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/std/time/duration/struct.Duration.html' title='std::time::duration::Duration'>Duration</a>&gt;) -&gt; <a class='type' href='https://doc.rust-lang.org/nightly/std/io/error/type.Result.html' title='std::io::error::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h3><div class='docblock'><p>Set the write timeout duration for this message.</p>
</div><h3 id='tymethod.close_connection' class='method stab '><code>fn <a href='#tymethod.close_connection' class='fnname'>close_connection</a>(&amp;mut self) -&gt; <a class='type' href='../../../hyper/error/type.Result.html' title='hyper::error::Result'>Result</a>&lt;<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>&gt;</code></h3><div class='docblock'><p>Closes the underlying HTTP connection.</p>
</div><h3 id='tymethod.has_body' class='method stab '><code>fn <a href='#tymethod.has_body' class='fnname'>has_body</a>(&amp;self) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h3><div class='docblock'><p>Returns whether the incoming message has a body.</p>
</div></div>
<h2 id='provided-methods'>Provided Methods</h2>
<div class='methods'>
<h3 id='method.set_proxied' class='method stab '><code>fn <a href='#method.set_proxied' class='fnname'>set_proxied</a>(&amp;mut self, val: <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a>)</code></h3><div class='docblock'><p>Called when the Client wishes to use a Proxy.</p>
</div></div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl <a class='trait' href='../../../hyper/http/message/trait.HttpMessage.html' title='hyper::http::message::HttpMessage'>HttpMessage</a></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-6659' class='srclink' href='../../../src/hyper/http/message.rs.html#95-133' title='goto source code'>[src]</a></span></h3>
<div class='impl-items'><h4 id='method.is' class='method'><code>fn <a href='#method.is' class='fnname'>is</a>&lt;T:&nbsp;<a class='trait' href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html' title='core::any::Any'>Any</a>&gt;(&amp;self) -&gt; <a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.bool.html'>bool</a></code></h4>
<div class='docblock'><p>Is the underlying type in this trait object a T?</p>
</div><h4 id='method.downcast_ref' class='method'><code>fn <a href='#method.downcast_ref' class='fnname'>downcast_ref</a>&lt;T:&nbsp;<a class='trait' href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html' title='core::any::Any'>Any</a>&gt;(&amp;self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;T&gt;</code></h4>
<div class='docblock'><p>If the underlying type is T, get a reference to the contained data.</p>
</div><h4 id='method.downcast_mut' class='method'><code>fn <a href='#method.downcast_mut' class='fnname'>downcast_mut</a>&lt;T:&nbsp;<a class='trait' href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html' title='core::any::Any'>Any</a>&gt;(&amp;mut self) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/option/enum.Option.html' title='core::option::Option'>Option</a>&lt;&amp;mut T&gt;</code></h4>
<div class='docblock'><p>If the underlying type is T, get a mutable reference to the contained
data.</p>
</div><h4 id='method.downcast' class='method'><code>fn <a href='#method.downcast' class='fnname'>downcast</a>&lt;T:&nbsp;<a class='trait' href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html' title='core::any::Any'>Any</a>&gt;(self: <a class='struct' href='https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html' title='alloc::boxed::Box'>Box</a>&lt;<a class='trait' href='../../../hyper/http/message/trait.HttpMessage.html' title='hyper::http::message::HttpMessage'>HttpMessage</a>&gt;) -&gt; <a class='enum' href='https://doc.rust-lang.org/nightly/core/result/enum.Result.html' title='core::result::Result'>Result</a>&lt;<a class='struct' href='https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html' title='alloc::boxed::Box'>Box</a>&lt;T&gt;,&nbsp;<a class='struct' href='https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html' title='alloc::boxed::Box'>Box</a>&lt;<a class='trait' href='../../../hyper/http/message/trait.HttpMessage.html' title='hyper::http::message::HttpMessage'>HttpMessage</a>&gt;&gt;</code></h4>
<div class='docblock'><p>If the underlying type is T, extract it.</p>
</div></div>
<h2 id='implementors'>Implementors</h2>
<ul class='item-list' id='implementors-list'>
<li><code>impl HttpMessage for <a class='struct' href='../../../hyper/http/h1/struct.Http11Message.html' title='hyper::http::h1::Http11Message'>Http11Message</a></code></li>
<li><code>impl&lt;S&gt; HttpMessage for <a class='struct' href='../../../hyper/http/h2/struct.Http2Message.html' title='hyper::http::h2::Http2Message'>Http2Message</a>&lt;S&gt; <span class='where'>where S: <a class='trait' href='../../../hyper/http/h2/trait.CloneableStream.html' title='hyper::http::h2::CloneableStream'>CloneableStream</a></span></code></li>
</ul><script type="text/javascript" async
src="../../../implementors/hyper/http/message/trait.HttpMessage.js">
</script></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>?</dt>
<dd>Show this help dialog</dd>
<dt>S</dt>
<dd>Focus the search field</dd>
<dt>&larrb;</dt>
<dd>Move up in search results</dd>
<dt>&rarrb;</dt>
<dd>Move down in search results</dd>
<dt>&#9166;</dt>
<dd>Go to active search result</dd>
<dt>+</dt>
<dd>Collapse/expand 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";
window.playgroundUrl = "";
</script>
<script src="../../../jquery.js"></script>
<script src="../../../main.js"></script>
<script defer src="../../../search-index.js"></script>
</body>
</html>