43 lines
8.6 KiB
HTML
43 lines
8.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="API documentation for the Rust `awc` crate."><meta name="keywords" content="rust, rustlang, rust-lang, awc"><title>awc - 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="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[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><a href='../awc/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate awc</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all awc's items</p></a><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'awc', ty: 'mod', relpath: '../'};</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"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><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/awc/lib.rs.html#1-201' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>awc</a></span></h1><div class='docblock'><p>An HTTP Client</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered">
|
||
<span class="kw">use</span> <span class="ident">futures</span>::<span class="ident">future</span>::{<span class="ident">lazy</span>, <span class="ident">Future</span>};
|
||
<span class="kw">use</span> <span class="ident">actix_rt</span>::<span class="ident">System</span>;
|
||
<span class="kw">use</span> <span class="ident">awc</span>::<span class="ident">Client</span>;
|
||
|
||
<span class="kw">fn</span> <span class="ident">main</span>() {
|
||
<span class="ident">System</span>::<span class="ident">new</span>(<span class="string">"test"</span>).<span class="ident">block_on</span>(<span class="ident">lazy</span>(<span class="op">|</span><span class="op">|</span> {
|
||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">client</span> <span class="op">=</span> <span class="ident">Client</span>::<span class="ident">default</span>();
|
||
|
||
<span class="ident">client</span>.<span class="ident">get</span>(<span class="string">"http://www.rust-lang.org"</span>) <span class="comment">// <- Create request builder</span>
|
||
.<span class="ident">header</span>(<span class="string">"User-Agent"</span>, <span class="string">"Actix-web"</span>)
|
||
.<span class="ident">send</span>() <span class="comment">// <- Send http request</span>
|
||
.<span class="ident">map_err</span>(<span class="op">|</span><span class="kw">_</span><span class="op">|</span> ())
|
||
.<span class="ident">and_then</span>(<span class="op">|</span><span class="ident">response</span><span class="op">|</span> { <span class="comment">// <- server http response</span>
|
||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"Response: {:?}"</span>, <span class="ident">response</span>);
|
||
<span class="prelude-val">Ok</span>(())
|
||
})
|
||
}));
|
||
}</pre></div>
|
||
</div><h2 id='modules' class='section-header'><a href="#modules">Modules</a></h2>
|
||
<table><tr class='module-item'><td><a class="mod" href="cookie/index.html" title='awc::cookie mod'>cookie</a></td><td class='docblock-short'><p>https://github.com/alexcrichton/cookie-rs fork</p>
|
||
</td></tr><tr class='module-item'><td><a class="mod" href="error/index.html" title='awc::error mod'>error</a></td><td class='docblock-short'><p>Http client errors</p>
|
||
</td></tr><tr class='module-item'><td><a class="mod" href="http/index.html" title='awc::http mod'>http</a></td><td class='docblock-short'><p>Various HTTP related types</p>
|
||
</td></tr><tr class='module-item'><td><a class="mod" href="test/index.html" title='awc::test mod'>test</a></td><td class='docblock-short'><p>Test helpers for actix http client to use during testing.</p>
|
||
</td></tr><tr class='module-item'><td><a class="mod" href="ws/index.html" title='awc::ws mod'>ws</a></td><td class='docblock-short'><p>Websockets client</p>
|
||
</td></tr></table><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
|
||
<table><tr class='module-item'><td><a class="struct" href="struct.BoxedSocket.html" title='awc::BoxedSocket struct'>BoxedSocket</a></td><td class='docblock-short'></td></tr><tr class='module-item'><td><a class="struct" href="struct.Client.html" title='awc::Client struct'>Client</a></td><td class='docblock-short'><p>An HTTP Client</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.ClientBuilder.html" title='awc::ClientBuilder struct'>ClientBuilder</a></td><td class='docblock-short'><p>An HTTP Client builder</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.ClientRequest.html" title='awc::ClientRequest struct'>ClientRequest</a></td><td class='docblock-short'><p>An HTTP Client request builder</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.ClientResponse.html" title='awc::ClientResponse struct'>ClientResponse</a></td><td class='docblock-short'><p>Client Response</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.Connector.html" title='awc::Connector struct'>Connector</a></td><td class='docblock-short'><p>Manages http client network connectivity
|
||
The <code>Connector</code> type uses a builder-like combinator pattern for service
|
||
construction that finishes by calling the <code>.finish()</code> method.</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.FrozenClientRequest.html" title='awc::FrozenClientRequest struct'>FrozenClientRequest</a></td><td class='docblock-short'><p><code>FrozenClientRequest</code> struct represents clonable client request.
|
||
It could be used to send same request multiple times.</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.FrozenSendBuilder.html" title='awc::FrozenSendBuilder struct'>FrozenSendBuilder</a></td><td class='docblock-short'><p>Builder that allows to modify extra headers.</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.JsonBody.html" title='awc::JsonBody struct'>JsonBody</a></td><td class='docblock-short'><p>Response's payload json parser, it resolves to a deserialized <code>T</code> value.</p>
|
||
</td></tr><tr class='module-item'><td><a class="struct" href="struct.MessageBody.html" title='awc::MessageBody struct'>MessageBody</a></td><td class='docblock-short'><p>Future that resolves to a complete http message body.</p>
|
||
</td></tr></table><h2 id='enums' class='section-header'><a href="#enums">Enums</a></h2>
|
||
<table><tr class='module-item'><td><a class="enum" href="enum.SendClientRequest.html" title='awc::SendClientRequest enum'>SendClientRequest</a></td><td class='docblock-short'><p>Future that sends request's payload and resolves to a server response.</p>
|
||
</td></tr></table></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "awc";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html> |