283 lines
28 KiB
HTML
283 lines
28 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 `tokio_service`.">
|
|||
|
<meta name="keywords" content="rust, rustlang, rust-lang, Service">
|
|||
|
|
|||
|
<title>tokio_service::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">Box<S></a><a href="#impl-Service">Rc<S></a><a href="#impl-Service">Arc<S></a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>tokio_service</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'>tokio_service</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 {
|
|||
|
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><Item = Self::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Response" title="type tokio_service::Service::Response">Response</a>, Error = Self::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Error" title="type tokio_service::Service::Error">Error</a>>;
|
|||
|
fn <a href='#tymethod.call' class='fnname'>call</a>(&self, req: Self::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Request" title="type tokio_service::Service::Request">Request</a>) -> Self::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Future" title="type tokio_service::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><Item = Self::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Response" title="type tokio_service::Service::Response">Response</a>, Error = Self::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Error" title="type tokio_service::Service::Error">Error</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="../tokio_service/trait.Service.html#associatedtype.Request" title="type tokio_service::Service::Request">Request</a>) -> Self::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Future" title="type tokio_service::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<S: <a class="trait" href="../tokio_service/trait.Service.html" title="trait tokio_service::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>> <a class="trait" href="../tokio_service/trait.Service.html" title="trait tokio_service::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></code><a href='#impl-Service' 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-1' class="type"><span id='Request.t-1' class='invisible'><code>type <a href='#associatedtype.Request' class="type">Request</a> = S::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Request" title="type tokio_service::Service::Request">Request</a></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::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Response" title="type tokio_service::Service::Response">Response</a></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> = S::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Error" title="type tokio_service::Service::Error">Error</a></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> = S::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Future" title="type tokio_service::Service::Future">Future</a></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: S::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Request" title="type tokio_service::Service::Request">Request</a>) -> S::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Future" title="type tokio_service::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><h3 id='impl-Service-1' class='impl'><span class='in-band'><code>impl<S: <a class="trait" href="../tokio_service/trait.Service.html" title="trait tokio_service::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>> <a class="trait" href="../tokio_service/trait.Service.html" title="trait tokio_service::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></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::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Request" title="type tokio_service::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::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Response" title="type tokio_service::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::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Error" title="type tokio_service::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::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Future" title="type tokio_service::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::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Request" title="type tokio_service::Service::Request">Request</a>) -> S::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Future" title="type tokio_service::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="../tokio_service/trait.Service.html" title="trait tokio_service::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>> <a class="trait" href="../tokio_service/trait.Service.html" title="trait tokio_service::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></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::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Request" title="type tokio_service::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::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Response" title="type tokio_service::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::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Error" title="type tokio_service::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::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Future" title="type tokio_service::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::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Request" title="type tokio_service::Service::Request">Request</a>) -> S::<a class="type" href="../tokio_service/trait.Service.html#associatedtype.Future" title="type tokio_service::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>
|
|||
|
<h2 id='implementors' class='small-section-header'>
|
|||
|
Implementors<a href='#implementors' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<ul class='item-list' id='implementors-list'>
|
|||
|
</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 = "tokio_service";
|
|||
|
</script>
|
|||
|
<script src="../main.js"></script>
|
|||
|
<script defer src="../search-index.js"></script>
|
|||
|
</body>
|
|||
|
</html>
|