176 lines
No EOL
13 KiB
HTML
176 lines
No EOL
13 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="API documentation for the Rust `SendRequest` struct in crate `hyper`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, SendRequest">
|
||
|
||
<title>hyper::client::conn::SendRequest - 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">☰</div>
|
||
|
||
<p class='location'>Struct SendRequest</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.poll_ready">poll_ready</a><a href="#method.send_request">send_request</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a></div></div><p class='location'><a href='../../index.html'>hyper</a>::<wbr><a href='../index.html'>client</a>::<wbr><a href='index.html'>conn</a></p><script>window.sidebarCurrent = {name: 'SendRequest', 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'>client</a>::<wbr><a href='index.html'>conn</a>::<wbr><a class="struct" href=''>SendRequest</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'>−</span>]
|
||
</a>
|
||
</span><a class='srclink' href='../../../src/hyper/client/conn.rs.html#33-36' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust struct'>pub struct SendRequest<B> { /* fields omitted */ }</pre><div class='docblock'><p>The sender side of an established connection.</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<B> <a class="struct" href="../../../hyper/client/conn/struct.SendRequest.html" title="struct hyper::client::conn::SendRequest">SendRequest</a><B></code><a href='#impl' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../../src/hyper/client/conn.rs.html#120-132' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.poll_ready' class="method"><span id='poll_ready.v' class='invisible'><code>pub fn <a href='#method.poll_ready' class='fnname'>poll_ready</a>(&mut self) -> <a class="type" href="../../../futures/poll/type.Poll.html" title="type futures::poll::Poll">Poll</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="enum" href="../../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../../src/hyper/client/conn.rs.html#125-127' title='goto source code'>[src]</a></span></h4>
|
||
<div class='docblock'><p>Polls to determine whether this sender can be used yet for a request.</p>
|
||
<p>If the associated connection is closed, this returns an Error.</p>
|
||
</div></div><h3 id='impl-1' class='impl'><span class='in-band'><code>impl<B> <a class="struct" href="../../../hyper/client/conn/struct.SendRequest.html" title="struct hyper::client::conn::SendRequest">SendRequest</a><B> <span class="where fmt-newline">where<br> B: <a class="trait" href="../../../futures/stream/trait.Stream.html" title="trait futures::stream::Stream">Stream</a><Error = <a class="enum" href="../../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>> + 'static,<br> B::<a class="type" href="../../../futures/stream/trait.Stream.html#associatedtype.Item" title="type futures::stream::Stream::Item">Item</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.AsRef.html" title="trait core::convert::AsRef">AsRef</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a>>, </span></code><a href='#impl-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../../src/hyper/client/conn.rs.html#134-240' title='goto source code'>[src]</a></span></h3>
|
||
<div class='impl-items'><h4 id='method.send_request' class="method"><span id='send_request.v' class='invisible'><code>pub fn <a href='#method.send_request' class='fnname'>send_request</a>(&mut self, req: <a class="struct" href="../../../hyper/struct.Request.html" title="struct hyper::Request">Request</a><B>) -> <a class="struct" href="../../../hyper/client/conn/struct.ResponseFuture.html" title="struct hyper::client::conn::ResponseFuture">ResponseFuture</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../../src/hyper/client/conn.rs.html#183-216' title='goto source code'>[src]</a></span></h4>
|
||
<div class='docblock'><p>Sends a <code>Request</code> on the associated connection.</p>
|
||
<p>Returns a future that if successful, yields the <code>Response</code>.</p>
|
||
<h1 id="note" class="section-header"><a href="#note">Note</a></h1>
|
||
<p>There are some key differences in what automatic things the <code>Client</code>
|
||
does for you that will not be done here:</p>
|
||
<ul>
|
||
<li><code>Client</code> requires absolute-form <code>Uri</code>s, since the scheme and
|
||
authority are need to connect. They aren't required here.</li>
|
||
<li>Since the <code>Client</code> requires absolute-form <code>Uri</code>s, it can add
|
||
the <code>Host</code> header based on it. You must add a <code>Host</code> header yourself
|
||
before calling this method.</li>
|
||
<li>Since absolute-form <code>Uri</code>s are not required, if received, they will
|
||
be serialized as-is, irregardless of calling <code>Request::set_proxy</code>.</li>
|
||
</ul>
|
||
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
|
||
<pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">futures</span>::<span class="ident">Future</span>;
|
||
<span class="kw">use</span> <span class="ident">hyper</span>::{<span class="ident">Method</span>, <span class="ident">Request</span>};
|
||
<span class="kw">use</span> <span class="ident">hyper</span>::<span class="ident">header</span>::<span class="ident">Host</span>;
|
||
|
||
<span class="comment">// build a Request</span>
|
||
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="string">"/foo/bar"</span>.<span class="ident">parse</span>().<span class="ident">expect</span>(<span class="string">"valid path"</span>);
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">req</span> <span class="op">=</span> <span class="ident">Request</span>::<span class="ident">new</span>(<span class="ident">Method</span>::<span class="ident">Get</span>, <span class="ident">path</span>);
|
||
<span class="ident">req</span>.<span class="ident">headers_mut</span>().<span class="ident">set</span>(<span class="ident">Host</span>::<span class="ident">new</span>(<span class="string">"hyper.rs"</span>, <span class="prelude-val">None</span>));
|
||
|
||
<span class="comment">// send it and get a future back</span>
|
||
<span class="kw">let</span> <span class="ident">fut</span> <span class="op">=</span> <span class="ident">tx</span>.<span class="ident">send_request</span>(<span class="ident">req</span>)
|
||
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">res</span><span class="op">|</span> {
|
||
<span class="comment">// got the Response</span>
|
||
<span class="macro">assert</span><span class="macro">!</span>(<span class="ident">res</span>.<span class="ident">status</span>().<span class="ident">is_success</span>());
|
||
});</pre>
|
||
</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<B> <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/client/conn/struct.SendRequest.html" title="struct hyper::client::conn::SendRequest">SendRequest</a><B></code><a href='#impl-Debug' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../../src/hyper/client/conn.rs.html#255-260' 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>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -> <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/client/conn.rs.html#256-259' 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></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>⏎</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> |