291 lines
No EOL
37 KiB
HTML
291 lines
No EOL
37 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 `Service` trait in crate `hyper`.">
|
||
<meta name="keywords" content="rust, rustlang, rust-lang, Service">
|
||
|
||
<title>hyper::server::Service - 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 trait">
|
||
<!--[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'>Trait Service</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Request">Request</a><a href="#associatedtype.Response">Response</a><a href="#associatedtype.Error">Error</a><a href="#associatedtype.Future">Future</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.call">call</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-Service">ClientProxy<R, S, E></a><a href="#impl-Service">Rc<S></a><a href="#impl-Service">Arc<S></a><a href="#impl-Service">Box<S></a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='../index.html'>hyper</a>::<wbr><a href='index.html'>server</a></p><script>window.sidebarCurrent = {name: 'Service', ty: 'trait', 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'>Trait <a href='../index.html'>hyper</a>::<wbr><a href='index.html'>server</a>::<wbr><a class="trait" href=''>Service</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/tokio_service/lib.rs.html#140-156' title='goto source code'>[src]</a></span></h1>
|
||
<pre class='rust trait'>pub trait Service <span class="where fmt-newline">where<br> <Self::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Future" title="type hyper::server::Service::Future">Future</a> as <a class="trait" href="../../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a>>::<a class="type" href="../../futures/future/trait.Future.html#associatedtype.Item" title="type futures::future::Future::Item">Item</a> == Self::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Response" title="type hyper::server::Service::Response">Response</a>,<br> <Self::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Future" title="type hyper::server::Service::Future">Future</a> as <a class="trait" href="../../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a>>::<a class="type" href="../../futures/future/trait.Future.html#associatedtype.Error" title="type futures::future::Future::Error">Error</a> == Self::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Error" title="type hyper::server::Service::Error">Error</a>, </span>{
|
||
type <a href='#associatedtype.Request' class="type">Request</a>;
|
||
type <a href='#associatedtype.Response' class="type">Response</a>;
|
||
type <a href='#associatedtype.Error' class="type">Error</a>;
|
||
type <a href='#associatedtype.Future' class="type">Future</a>: <a class="trait" href="../../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a>;
|
||
fn <a href='#tymethod.call' class='fnname'>call</a>(&self, req: Self::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Request" title="type hyper::server::Service::Request">Request</a>) -> Self::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Future" title="type hyper::server::Service::Future">Future</a>;
|
||
}</pre><div class='docblock'><p>An asynchronous function from <code>Request</code> to a <code>Response</code>.</p>
|
||
<p>The <code>Service</code> trait is a simplified interface making it easy to write
|
||
network applications in a modular and reusable way, decoupled from the
|
||
underlying protocol. It is one of Tokio's fundamental abstractions.</p>
|
||
<h1 id="functional" class="section-header"><a href="#functional">Functional</a></h1>
|
||
<p>A <code>Service</code> is a function from a <code>Request</code>. It immediately returns a
|
||
<code>Future</code> representing the eventual completion of processing the
|
||
request. The actual request processing may happen at any time in the
|
||
future, on any thread or executor. The processing may depend on calling
|
||
other services. At some point in the future, the processing will complete,
|
||
and the <code>Future</code> will resolve to a response or error.</p>
|
||
<p>At a high level, the <code>Service::call</code> represents an RPC request. The
|
||
<code>Service</code> value can be a server or a client.</p>
|
||
<h1 id="server" class="section-header"><a href="#server">Server</a></h1>
|
||
<p>An RPC server <em>implements</em> the <code>Service</code> trait. Requests received by the
|
||
server over the network are deserialized then passed as an argument to the
|
||
server value. The returned response is sent back over the network.</p>
|
||
<p>As an example, here is how an HTTP request is processed by a server:</p>
|
||
|
||
<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
|
||
<span class="kw">impl</span> <span class="ident">Service</span> <span class="kw">for</span> <span class="ident">HelloWorld</span> {
|
||
<span class="kw">type</span> <span class="ident">Request</span> <span class="op">=</span> <span class="ident">http</span>::<span class="ident">Request</span>;
|
||
<span class="kw">type</span> <span class="ident">Response</span> <span class="op">=</span> <span class="ident">http</span>::<span class="ident">Response</span>;
|
||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">http</span>::<span class="ident">Error</span>;
|
||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">Box</span><span class="op"><</span><span class="ident">Future</span><span class="op"><</span><span class="ident">Item</span> <span class="op">=</span> <span class="self">Self</span>::<span class="ident">Response</span>, <span class="ident">Error</span> <span class="op">=</span> <span class="ident">http</span>::<span class="ident">Error</span><span class="op">>></span>;
|
||
|
||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="ident">http</span>::<span class="ident">Request</span>) <span class="op">-></span> <span class="self">Self</span>::<span class="ident">Future</span> {
|
||
<span class="comment">// Create the HTTP response</span>
|
||
<span class="kw">let</span> <span class="ident">resp</span> <span class="op">=</span> <span class="ident">http</span>::<span class="ident">Response</span>::<span class="ident">ok</span>()
|
||
.<span class="ident">with_body</span>(<span class="string">b"hello world\n"</span>);
|
||
|
||
<span class="comment">// Return the response as an immediate future</span>
|
||
<span class="ident">futures</span>::<span class="ident">finished</span>(<span class="ident">resp</span>).<span class="ident">boxed</span>()
|
||
}
|
||
}</pre>
|
||
<h1 id="client" class="section-header"><a href="#client">Client</a></h1>
|
||
<p>A client consumes a service by using a <code>Service</code> value. The client may
|
||
issue requests by invoking <code>call</code> and passing the request as an argument.
|
||
It then receives the response by waiting for the returned future.</p>
|
||
<p>As an example, here is how a Redis request would be issued:</p>
|
||
|
||
<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
|
||
<span class="kw">let</span> <span class="ident">client</span> <span class="op">=</span> <span class="ident">redis</span>::<span class="ident">Client</span>::<span class="ident">new</span>()
|
||
.<span class="ident">connect</span>(<span class="string">"127.0.0.1:6379"</span>.<span class="ident">parse</span>().<span class="ident">unwrap</span>())
|
||
.<span class="ident">unwrap</span>();
|
||
|
||
<span class="kw">let</span> <span class="ident">resp</span> <span class="op">=</span> <span class="ident">client</span>.<span class="ident">call</span>(<span class="ident">Cmd</span>::<span class="ident">set</span>(<span class="string">"foo"</span>, <span class="string">"this is the value of foo"</span>));
|
||
|
||
<span class="comment">// Wait for the future to resolve</span>
|
||
<span class="macro">println</span><span class="macro">!</span>(<span class="string">"Redis response: {:?}"</span>, <span class="ident">await</span>(<span class="ident">resp</span>));</pre>
|
||
<h1 id="middleware" class="section-header"><a href="#middleware">Middleware</a></h1>
|
||
<p>More often than not, all the pieces needed for writing robust, scalable
|
||
network applications are the same no matter the underlying protocol. By
|
||
unifying the API for both clients and servers in a protocol agnostic way,
|
||
it is possible to write middleware that provide these pieces in a
|
||
reusable way.</p>
|
||
<p>For example, take timeouts as an example:</p>
|
||
|
||
<div class='information'><div class='tooltip ignore'>ⓘ<span class='tooltiptext'>This example is not tested</span></div></div><pre class="rust rust-example-rendered ignore">
|
||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">Service</span>;
|
||
<span class="kw">use</span> <span class="ident">futures</span>::<span class="ident">Future</span>;
|
||
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">time</span>::<span class="ident">Duration</span>;
|
||
|
||
<span class="comment">// Not yet implemented, but soon :)</span>
|
||
<span class="kw">use</span> <span class="ident">tokio</span>::<span class="ident">timer</span>::{<span class="ident">Timer</span>, <span class="ident">Expired</span>};
|
||
|
||
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">Timeout</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||
<span class="ident">upstream</span>: <span class="ident">T</span>,
|
||
<span class="ident">delay</span>: <span class="ident">Duration</span>,
|
||
<span class="ident">timer</span>: <span class="ident">Timer</span>,
|
||
}
|
||
|
||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> <span class="ident">Timeout</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">upstream</span>: <span class="ident">T</span>, <span class="ident">delay</span>: <span class="ident">Duration</span>) <span class="op">-></span> <span class="ident">Timeout</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||
<span class="ident">Timeout</span> {
|
||
<span class="ident">upstream</span>: <span class="ident">upstream</span>,
|
||
<span class="ident">delay</span>: <span class="ident">delay</span>,
|
||
<span class="ident">timer</span>: <span class="ident">Timer</span>::<span class="ident">default</span>(),
|
||
}
|
||
}
|
||
}
|
||
|
||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> <span class="ident">Service</span> <span class="kw">for</span> <span class="ident">Timeout</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>
|
||
<span class="kw">where</span> <span class="ident">T</span>: <span class="ident">Service</span>,
|
||
<span class="ident">T</span>::<span class="ident">Error</span>: <span class="ident">From</span><span class="op"><</span><span class="ident">Expired</span><span class="op">></span>,
|
||
{
|
||
<span class="kw">type</span> <span class="ident">Request</span> <span class="op">=</span> <span class="ident">T</span>::<span class="ident">Request</span>;
|
||
<span class="kw">type</span> <span class="ident">Response</span> <span class="op">=</span> <span class="ident">T</span>::<span class="ident">Response</span>;
|
||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">T</span>::<span class="ident">Error</span>;
|
||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">Box</span><span class="op"><</span><span class="ident">Future</span><span class="op"><</span><span class="ident">Item</span> <span class="op">=</span> <span class="self">Self</span>::<span class="ident">Response</span>, <span class="ident">Error</span> <span class="op">=</span> <span class="self">Self</span>::<span class="ident">Error</span><span class="op">>></span>;
|
||
|
||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="self">Self</span>::<span class="ident">Req</span>) <span class="op">-></span> <span class="self">Self</span>::<span class="ident">Future</span> {
|
||
<span class="kw">let</span> <span class="ident">timeout</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">timer</span>.<span class="ident">timeout</span>(<span class="self">self</span>.<span class="ident">delay</span>)
|
||
.<span class="ident">and_then</span>(<span class="op">|</span><span class="ident">timeout</span><span class="op">|</span> <span class="prelude-val">Err</span>(<span class="self">Self</span>::<span class="ident">Error</span>::<span class="ident">from</span>(<span class="ident">timeout</span>)));
|
||
|
||
<span class="self">self</span>.<span class="ident">upstream</span>.<span class="ident">call</span>(<span class="ident">req</span>)
|
||
.<span class="ident">select</span>(<span class="ident">timeout</span>)
|
||
.<span class="ident">map</span>(<span class="op">|</span>(<span class="ident">v</span>, _)<span class="op">|</span> <span class="ident">v</span>)
|
||
.<span class="ident">map_err</span>(<span class="op">|</span>(<span class="ident">e</span>, _)<span class="op">|</span> <span class="ident">e</span>)
|
||
.<span class="ident">boxed</span>()
|
||
}
|
||
}
|
||
</pre>
|
||
<p>The above timeout implementation is decoupled from the underlying protocol
|
||
and is also decoupled from client or server concerns. In other words, the
|
||
same timeout middleware could be used in either a client or a server.</p>
|
||
</div>
|
||
<h2 id='associated-types' class='small-section-header'>
|
||
Associated Types<a href='#associated-types' class='anchor'></a>
|
||
</h2>
|
||
<div class='methods'>
|
||
<h3 id='associatedtype.Request' class='method'><span id='Request.t' class='invisible'><code>type <a href='#associatedtype.Request' class="type">Request</a></code></span></h3><div class='docblock'><p>Requests handled by the service.</p>
|
||
</div><h3 id='associatedtype.Response' class='method'><span id='Response.t' class='invisible'><code>type <a href='#associatedtype.Response' class="type">Response</a></code></span></h3><div class='docblock'><p>Responses given by the service.</p>
|
||
</div><h3 id='associatedtype.Error' class='method'><span id='Error.t' class='invisible'><code>type <a href='#associatedtype.Error' class="type">Error</a></code></span></h3><div class='docblock'><p>Errors produced by the service.</p>
|
||
</div><h3 id='associatedtype.Future' class='method'><span id='Future.t' class='invisible'><code>type <a href='#associatedtype.Future' class="type">Future</a>: <a class="trait" href="../../futures/future/trait.Future.html" title="trait futures::future::Future">Future</a></code></span></h3><div class='docblock'><p>The future response value.</p>
|
||
</div></div>
|
||
<h2 id='required-methods' class='small-section-header'>
|
||
Required Methods<a href='#required-methods' class='anchor'></a>
|
||
</h2>
|
||
<div class='methods'>
|
||
<h3 id='tymethod.call' class='method'><span id='call.v' class='invisible'><code>fn <a href='#tymethod.call' class='fnname'>call</a>(&self, req: Self::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Request" title="type hyper::server::Service::Request">Request</a>) -> Self::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Future" title="type hyper::server::Service::Future">Future</a></code></span></h3><div class='docblock'><p>Process the request and return the response asynchronously.</p>
|
||
</div></div>
|
||
<h2 id='foreign-impls' class='small-section-header'>
|
||
Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a>
|
||
</h2>
|
||
<h3 id='impl-Service' class='impl'><span class='in-band'><code>impl<R, S, E> <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a> for <a class="struct" href="../../tokio_proto/util/client_proxy/struct.ClientProxy.html" title="struct tokio_proto::util::client_proxy::ClientProxy">ClientProxy</a><R, S, E> <span class="where fmt-newline">where<br> E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>>, </span></code><a href='#impl-Service' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_proto/util/client_proxy.rs.html#61-81' title='goto source code'>[src]</a></span></h3>
|
||
<span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Request-1' class="type"><span id='Request.t-1' class='invisible'><code>type <a href='#associatedtype.Request' class="type">Request</a> = R</code></span></h4>
|
||
<h4 id='associatedtype.Response-1' class="type"><span id='Response.t-1' class='invisible'><code>type <a href='#associatedtype.Response' class="type">Response</a> = S</code></span></h4>
|
||
<h4 id='associatedtype.Error-1' class="type"><span id='Error.t-1' class='invisible'><code>type <a href='#associatedtype.Error' class="type">Error</a> = E</code></span></h4>
|
||
<h4 id='associatedtype.Future-1' class="type"><span id='Future.t-1' class='invisible'><code>type <a href='#associatedtype.Future' class="type">Future</a> = <a class="struct" href="../../tokio_proto/util/client_proxy/struct.Response.html" title="struct tokio_proto::util::client_proxy::Response">Response</a><S, E></code></span></h4>
|
||
<h4 id='method.call' class="method"><span id='call.v-1' class='invisible'><code>fn <a href='#method.call' class='fnname'>call</a>(&self, request: R) -> <<a class="struct" href="../../tokio_proto/util/client_proxy/struct.ClientProxy.html" title="struct tokio_proto::util::client_proxy::ClientProxy">ClientProxy</a><R, S, E> as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Future" title="type hyper::server::Service::Future">Future</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_proto/util/client_proxy.rs.html#67-80' title='goto source code'>[src]</a></span></h4>
|
||
</div></span><h3 id='impl-Service-1' class='impl'><span class='in-band'><code>impl<S> <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a><S> <span class="where fmt-newline">where<br> S: <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Service-1' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_service/lib.rs.html#223-232' title='goto source code'>[src]</a></span></h3>
|
||
<span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Request-2' class="type"><span id='Request.t-2' class='invisible'><code>type <a href='#associatedtype.Request' class="type">Request</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Request" title="type hyper::server::Service::Request">Request</a></code></span></h4>
|
||
<h4 id='associatedtype.Response-2' class="type"><span id='Response.t-2' class='invisible'><code>type <a href='#associatedtype.Response' class="type">Response</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Response" title="type hyper::server::Service::Response">Response</a></code></span></h4>
|
||
<h4 id='associatedtype.Error-2' class="type"><span id='Error.t-2' class='invisible'><code>type <a href='#associatedtype.Error' class="type">Error</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Error" title="type hyper::server::Service::Error">Error</a></code></span></h4>
|
||
<h4 id='associatedtype.Future-2' class="type"><span id='Future.t-2' class='invisible'><code>type <a href='#associatedtype.Future' class="type">Future</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Future" title="type hyper::server::Service::Future">Future</a></code></span></h4>
|
||
<h4 id='method.call-1' class="method"><span id='call.v-2' class='invisible'><code>fn <a href='#method.call' class='fnname'>call</a>(&self, request: <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Request" title="type hyper::server::Service::Request">Request</a>) -> <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Future" title="type hyper::server::Service::Future">Future</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_service/lib.rs.html#229-231' title='goto source code'>[src]</a></span></h4>
|
||
</div></span><h3 id='impl-Service-2' class='impl'><span class='in-band'><code>impl<S> <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/arc/struct.Arc.html" title="struct alloc::arc::Arc">Arc</a><S> <span class="where fmt-newline">where<br> S: <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Service-2' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_service/lib.rs.html#234-243' title='goto source code'>[src]</a></span></h3>
|
||
<span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Request-3' class="type"><span id='Request.t-3' class='invisible'><code>type <a href='#associatedtype.Request' class="type">Request</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Request" title="type hyper::server::Service::Request">Request</a></code></span></h4>
|
||
<h4 id='associatedtype.Response-3' class="type"><span id='Response.t-3' class='invisible'><code>type <a href='#associatedtype.Response' class="type">Response</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Response" title="type hyper::server::Service::Response">Response</a></code></span></h4>
|
||
<h4 id='associatedtype.Error-3' class="type"><span id='Error.t-3' class='invisible'><code>type <a href='#associatedtype.Error' class="type">Error</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Error" title="type hyper::server::Service::Error">Error</a></code></span></h4>
|
||
<h4 id='associatedtype.Future-3' class="type"><span id='Future.t-3' class='invisible'><code>type <a href='#associatedtype.Future' class="type">Future</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Future" title="type hyper::server::Service::Future">Future</a></code></span></h4>
|
||
<h4 id='method.call-2' class="method"><span id='call.v-3' class='invisible'><code>fn <a href='#method.call' class='fnname'>call</a>(&self, request: <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Request" title="type hyper::server::Service::Request">Request</a>) -> <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Future" title="type hyper::server::Service::Future">Future</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_service/lib.rs.html#240-242' title='goto source code'>[src]</a></span></h4>
|
||
</div></span><h3 id='impl-Service-3' class='impl'><span class='in-band'><code>impl<S> <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><S> <span class="where fmt-newline">where<br> S: <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></code><a href='#impl-Service-3' class='anchor'></a></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_service/lib.rs.html#212-221' title='goto source code'>[src]</a></span></h3>
|
||
<span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Request-4' class="type"><span id='Request.t-4' class='invisible'><code>type <a href='#associatedtype.Request' class="type">Request</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Request" title="type hyper::server::Service::Request">Request</a></code></span></h4>
|
||
<h4 id='associatedtype.Response-4' class="type"><span id='Response.t-4' class='invisible'><code>type <a href='#associatedtype.Response' class="type">Response</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Response" title="type hyper::server::Service::Response">Response</a></code></span></h4>
|
||
<h4 id='associatedtype.Error-4' class="type"><span id='Error.t-4' class='invisible'><code>type <a href='#associatedtype.Error' class="type">Error</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Error" title="type hyper::server::Service::Error">Error</a></code></span></h4>
|
||
<h4 id='associatedtype.Future-4' class="type"><span id='Future.t-4' class='invisible'><code>type <a href='#associatedtype.Future' class="type">Future</a> = <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Future" title="type hyper::server::Service::Future">Future</a></code></span></h4>
|
||
<h4 id='method.call-3' class="method"><span id='call.v-4' class='invisible'><code>fn <a href='#method.call' class='fnname'>call</a>(&self, request: <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Request" title="type hyper::server::Service::Request">Request</a>) -> <S as <a class="trait" href="../../hyper/server/trait.Service.html" title="trait hyper::server::Service">Service</a>>::<a class="type" href="../../hyper/server/trait.Service.html#associatedtype.Future" title="type hyper::server::Service::Future">Future</a></code></span><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../../src/tokio_service/lib.rs.html#218-220' title='goto source code'>[src]</a></span></h4>
|
||
</div></span>
|
||
<h2 id='implementors' class='small-section-header'>
|
||
Implementors<a href='#implementors' class='anchor'></a>
|
||
</h2>
|
||
<ul class='item-list' id='implementors-list'>
|
||
<li><div class='out-of-band'><a class='srclink' href='../../src/hyper/client/connect.rs.html#111-146' title='goto source code'>[src]</a></div><code>impl Service for <a class="struct" href="../../hyper/client/struct.HttpConnector.html" title="struct hyper::client::HttpConnector">HttpConnector</a><span class="where fmt-newline"> type <a href='#associatedtype.Request' class="type">Request</a> = <a class="struct" href="../../hyper/struct.Uri.html" title="struct hyper::Uri">Uri</a>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Response' class="type">Response</a> = <a class="struct" href="../../tokio_core/net/tcp/struct.TcpStream.html" title="struct tokio_core::net::tcp::TcpStream">TcpStream</a>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Error' class="type">Error</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Future' class="type">Future</a> = HttpConnecting;</span></code></li>
|
||
<li><div class='out-of-band'><a class='srclink' href='../../src/hyper/client/mod.rs.html#299-312' title='goto source code'>[src]</a></div><code>impl<C, B> Service for <a class="struct" href="../../hyper/client/struct.Client.html" title="struct hyper::client::Client">Client</a><C, B> <span class="where fmt-newline">where<br> C: <a class="trait" href="../../hyper/client/trait.Connect.html" title="trait hyper::client::Connect">Connect</a>,<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><span class="where fmt-newline"> type <a href='#associatedtype.Request' class="type">Request</a> = <a class="struct" href="../../hyper/struct.Request.html" title="struct hyper::Request">Request</a><B>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Response' class="type">Response</a> = <a class="struct" href="../../hyper/struct.Response.html" title="struct hyper::Response">Response</a>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Error' class="type">Error</a> = <a class="enum" href="../../hyper/error/enum.Error.html" title="enum hyper::error::Error">Error</a>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Future' class="type">Future</a> = <a class="struct" href="../../hyper/client/struct.FutureResponse.html" title="struct hyper::client::FutureResponse">FutureResponse</a>;</span></code></li>
|
||
</ul><script type="text/javascript" async
|
||
src="../../implementors/tokio_service/trait.Service.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><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> |