328 lines
88 KiB
HTML
328 lines
88 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="An asynchronous function from a `Request` to a `Response`."><title>Service in tower - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="tower" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Service</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../tower/index.html">tower</a><span class="version">0.5.3</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Service</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#functional" title="Functional">Functional</a></li><li><a href="#server" title="Server">Server</a></li><li><a href="#client" title="Client">Client</a></li><li><a href="#middleware--layer" title="Middleware / Layer">Middleware / Layer</a></li><li><a href="#backpressure" title="Backpressure">Backpressure</a></li><li><a href="#be-careful-when-cloning-inner-services" title="Be careful when cloning inner services">Be careful when cloning inner services</a></li></ul><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Error" title="Error">Error</a></li><li><a href="#associatedtype.Future" title="Future">Future</a></li><li><a href="#associatedtype.Response" title="Response">Response</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.call" title="call">call</a></li><li><a href="#tymethod.poll_ready" title="poll_ready">poll_ready</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Service%3CRequest%3E-for-%26mut+S" title="&'a mut S">&'a mut S</a></li><li><a href="#impl-Service%3CRequest%3E-for-Box%3CS%3E" title="Box<S>">Box<S></a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate tower</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="index.html">tower</a></div><h1>Trait <span class="trait">Service</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/tower_service/lib.rs.html#311">Source</a> </span></div><pre class="rust item-decl"><code>pub trait Service<Request> {
|
||
type <a href="#associatedtype.Response" class="associatedtype">Response</a>;
|
||
type <a href="#associatedtype.Error" class="associatedtype">Error</a>;
|
||
type <a href="#associatedtype.Future" class="associatedtype">Future</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a>, Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>>>;
|
||
|
||
// Required methods
|
||
fn <a href="#tymethod.poll_ready" class="fn">poll_ready</a>(
|
||
&mut self,
|
||
cx: &mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>>>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.call" class="fn">call</a>(&mut self, req: Request) -> Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a>;
|
||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An asynchronous function from a <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 Tower’s fundamental abstractions.</p>
|
||
<h2 id="functional"><a class="doc-anchor" href="#functional">§</a>Functional</h2>
|
||
<p>A <code>Service</code> is a function of 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> function represents an RPC request. The
|
||
<code>Service</code> value can be a server or a client.</p>
|
||
<h2 id="server"><a class="doc-anchor" href="#server">§</a>Server</h2>
|
||
<p>An RPC server <em>implements</em> the <code>Service</code> trait. Requests received by the
|
||
server over the network are deserialized and 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="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>http::{Request, Response, StatusCode};
|
||
|
||
<span class="kw">struct </span>HelloWorld;
|
||
|
||
<span class="kw">impl </span>Service<Request<Vec<u8>>> <span class="kw">for </span>HelloWorld {
|
||
<span class="kw">type </span>Response = Response<Vec<u8>>;
|
||
<span class="kw">type </span>Error = http::Error;
|
||
<span class="kw">type </span>Future = Pin<Box<<span class="kw">dyn </span>Future<Output = <span class="prelude-ty">Result</span><<span class="self">Self</span>::Response, <span class="self">Self</span>::Error>>>>;
|
||
|
||
<span class="kw">fn </span>poll_ready(<span class="kw-2">&mut </span><span class="self">self</span>, cx: <span class="kw-2">&mut </span>Context<<span class="lifetime">'_</span>>) -> Poll<<span class="prelude-ty">Result</span><(), <span class="self">Self</span>::Error>> {
|
||
Poll::Ready(<span class="prelude-val">Ok</span>(()))
|
||
}
|
||
|
||
<span class="kw">fn </span>call(<span class="kw-2">&mut </span><span class="self">self</span>, req: Request<Vec<u8>>) -> <span class="self">Self</span>::Future {
|
||
<span class="comment">// create the body
|
||
</span><span class="kw">let </span>body: Vec<u8> = <span class="string">"hello, world!\n"
|
||
</span>.as_bytes()
|
||
.to_owned();
|
||
<span class="comment">// Create the HTTP response
|
||
</span><span class="kw">let </span>resp = Response::builder()
|
||
.status(StatusCode::OK)
|
||
.body(body)
|
||
.expect(<span class="string">"Unable to create `http::Response`"</span>);
|
||
|
||
<span class="comment">// create a response in a future.
|
||
</span><span class="kw">let </span>fut = <span class="kw">async </span>{
|
||
<span class="prelude-val">Ok</span>(resp)
|
||
};
|
||
|
||
<span class="comment">// Return the response as an immediate future
|
||
</span>Box::pin(fut)
|
||
}
|
||
}</code></pre></div><h2 id="client"><a class="doc-anchor" href="#client">§</a>Client</h2>
|
||
<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="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested">ⓘ</a><pre class="rust rust-example-rendered"><code><span class="kw">let </span>client = redis::Client::new()
|
||
.connect(<span class="string">"127.0.0.1:6379"</span>.parse().unwrap())
|
||
.unwrap();
|
||
|
||
<span class="kw">let </span>resp = client.call(Cmd::set(<span class="string">"foo"</span>, <span class="string">"this is the value of foo"</span>)).<span class="kw">await</span><span class="question-mark">?</span>;
|
||
|
||
<span class="comment">// Wait for the future to resolve
|
||
</span><span class="macro">println!</span>(<span class="string">"Redis response: {:?}"</span>, resp);</code></pre></div><h2 id="middleware--layer"><a class="doc-anchor" href="#middleware--layer">§</a>Middleware / Layer</h2>
|
||
<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>Take timeouts as an example:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>tower_service::Service;
|
||
<span class="kw">use </span>tower_layer::Layer;
|
||
<span class="kw">use </span>futures::FutureExt;
|
||
<span class="kw">use </span>std::future::Future;
|
||
<span class="kw">use </span>std::task::{Context, Poll};
|
||
<span class="kw">use </span>std::time::Duration;
|
||
<span class="kw">use </span>std::pin::Pin;
|
||
<span class="kw">use </span>std::fmt;
|
||
<span class="kw">use </span>std::error::Error;
|
||
|
||
<span class="comment">// Our timeout service, which wraps another service and
|
||
// adds a timeout to its response future.
|
||
</span><span class="kw">pub struct </span>Timeout<T> {
|
||
inner: T,
|
||
timeout: Duration,
|
||
}
|
||
|
||
<span class="kw">impl</span><T> Timeout<T> {
|
||
<span class="kw">pub const fn </span>new(inner: T, timeout: Duration) -> Timeout<T> {
|
||
Timeout {
|
||
inner,
|
||
timeout
|
||
}
|
||
}
|
||
}
|
||
|
||
<span class="comment">// The error returned if processing a request timed out
|
||
</span><span class="attr">#[derive(Debug)]
|
||
</span><span class="kw">pub struct </span>Expired;
|
||
|
||
<span class="kw">impl </span>fmt::Display <span class="kw">for </span>Expired {
|
||
<span class="kw">fn </span>fmt(<span class="kw-2">&</span><span class="self">self</span>, f: <span class="kw-2">&mut </span>fmt::Formatter<<span class="lifetime">'_</span>>) -> fmt::Result {
|
||
<span class="macro">write!</span>(f, <span class="string">"expired"</span>)
|
||
}
|
||
}
|
||
|
||
<span class="kw">impl </span>Error <span class="kw">for </span>Expired {}
|
||
|
||
<span class="comment">// We can implement `Service` for `Timeout<T>` if `T` is a `Service`
|
||
</span><span class="kw">impl</span><T, Request> Service<Request> <span class="kw">for </span>Timeout<T>
|
||
<span class="kw">where
|
||
</span>T: Service<Request>,
|
||
T::Future: <span class="lifetime">'static</span>,
|
||
T::Error: Into<Box<<span class="kw">dyn </span>Error + Send + Sync>> + <span class="lifetime">'static</span>,
|
||
T::Response: <span class="lifetime">'static</span>,
|
||
{
|
||
<span class="comment">// `Timeout` doesn't modify the response type, so we use `T`'s response type
|
||
</span><span class="kw">type </span>Response = T::Response;
|
||
<span class="comment">// Errors may be either `Expired` if the timeout expired, or the inner service's
|
||
// `Error` type. Therefore, we return a boxed `dyn Error + Send + Sync` trait object to erase
|
||
// the error's type.
|
||
</span><span class="kw">type </span>Error = Box<<span class="kw">dyn </span>Error + Send + Sync>;
|
||
<span class="kw">type </span>Future = Pin<Box<<span class="kw">dyn </span>Future<Output = <span class="prelude-ty">Result</span><<span class="self">Self</span>::Response, <span class="self">Self</span>::Error>>>>;
|
||
|
||
<span class="kw">fn </span>poll_ready(<span class="kw-2">&mut </span><span class="self">self</span>, cx: <span class="kw-2">&mut </span>Context<<span class="lifetime">'_</span>>) -> Poll<<span class="prelude-ty">Result</span><(), <span class="self">Self</span>::Error>> {
|
||
<span class="comment">// Our timeout service is ready if the inner service is ready.
|
||
// This is how backpressure can be propagated through a tree of nested services.
|
||
</span><span class="self">self</span>.inner.poll_ready(cx).map_err(Into::into)
|
||
}
|
||
|
||
<span class="kw">fn </span>call(<span class="kw-2">&mut </span><span class="self">self</span>, req: Request) -> <span class="self">Self</span>::Future {
|
||
<span class="comment">// Create a future that completes after `self.timeout`
|
||
</span><span class="kw">let </span>timeout = tokio::time::sleep(<span class="self">self</span>.timeout);
|
||
|
||
<span class="comment">// Call the inner service and get a future that resolves to the response
|
||
</span><span class="kw">let </span>fut = <span class="self">self</span>.inner.call(req);
|
||
|
||
<span class="comment">// Wrap those two futures in another future that completes when either one completes
|
||
//
|
||
// If the inner service is too slow the `sleep` future will complete first
|
||
// And an error will be returned and `fut` will be dropped and not polled again
|
||
//
|
||
// We have to box the errors so the types match
|
||
</span><span class="kw">let </span>f = <span class="kw">async move </span>{
|
||
<span class="macro">tokio::select!</span> {
|
||
res = fut => {
|
||
res.map_err(|err| err.into())
|
||
},
|
||
<span class="kw">_ </span>= timeout => {
|
||
<span class="prelude-val">Err</span>(Box::new(Expired) <span class="kw">as </span>Box<<span class="kw">dyn </span>Error + Send + Sync>)
|
||
},
|
||
}
|
||
};
|
||
|
||
Box::pin(f)
|
||
}
|
||
}
|
||
|
||
<span class="comment">// A layer for wrapping services in `Timeout`
|
||
</span><span class="kw">pub struct </span>TimeoutLayer(Duration);
|
||
|
||
<span class="kw">impl </span>TimeoutLayer {
|
||
<span class="kw">pub const fn </span>new(delay: Duration) -> <span class="self">Self </span>{
|
||
TimeoutLayer(delay)
|
||
}
|
||
}
|
||
|
||
<span class="kw">impl</span><S> Layer<S> <span class="kw">for </span>TimeoutLayer {
|
||
<span class="kw">type </span>Service = Timeout<S>;
|
||
|
||
<span class="kw">fn </span>layer(<span class="kw-2">&</span><span class="self">self</span>, service: S) -> Timeout<S> {
|
||
Timeout::new(service, <span class="self">self</span>.<span class="number">0</span>)
|
||
}
|
||
}</code></pre></div>
|
||
<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>
|
||
<h2 id="backpressure"><a class="doc-anchor" href="#backpressure">§</a>Backpressure</h2>
|
||
<p>Calling a <code>Service</code> which is at capacity (i.e., it is temporarily unable to process a
|
||
request) should result in an error. The caller is responsible for ensuring
|
||
that the service is ready to receive the request before calling it.</p>
|
||
<p><code>Service</code> provides a mechanism by which the caller is able to coordinate
|
||
readiness. <code>Service::poll_ready</code> returns <code>Ready</code> if the service expects that
|
||
it is able to process a request.</p>
|
||
<h2 id="be-careful-when-cloning-inner-services"><a class="doc-anchor" href="#be-careful-when-cloning-inner-services">§</a>Be careful when cloning inner services</h2>
|
||
<p>Services are permitted to panic if <code>call</code> is invoked without obtaining <code>Poll::Ready(Ok(()))</code>
|
||
from <code>poll_ready</code>. You should therefore be careful when cloning services for example to move
|
||
them into boxed futures. Even though the original service is ready, the clone might not be.</p>
|
||
<p>Therefore this kind of code is wrong and might panic:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">struct </span>Wrapper<S> {
|
||
inner: S,
|
||
}
|
||
|
||
<span class="kw">impl</span><R, S> Service<R> <span class="kw">for </span>Wrapper<S>
|
||
<span class="kw">where
|
||
</span>S: Service<R> + Clone + <span class="lifetime">'static</span>,
|
||
R: <span class="lifetime">'static</span>,
|
||
{
|
||
<span class="kw">type </span>Response = S::Response;
|
||
<span class="kw">type </span>Error = S::Error;
|
||
<span class="kw">type </span>Future = Pin<Box<<span class="kw">dyn </span>Future<Output = <span class="prelude-ty">Result</span><<span class="self">Self</span>::Response, <span class="self">Self</span>::Error>>>>;
|
||
|
||
<span class="kw">fn </span>poll_ready(<span class="kw-2">&mut </span><span class="self">self</span>, cx: <span class="kw-2">&mut </span>Context<<span class="lifetime">'_</span>>) -> Poll<<span class="prelude-ty">Result</span><(), <span class="self">Self</span>::Error>> {
|
||
<span class="self">self</span>.inner.poll_ready(cx)
|
||
}
|
||
|
||
<span class="kw">fn </span>call(<span class="kw-2">&mut </span><span class="self">self</span>, req: R) -> <span class="self">Self</span>::Future {
|
||
<span class="kw">let </span><span class="kw-2">mut </span>inner = <span class="self">self</span>.inner.clone();
|
||
Box::pin(<span class="kw">async move </span>{
|
||
<span class="comment">// `inner` might not be ready since its a clone
|
||
</span>inner.call(req).<span class="kw">await
|
||
</span>})
|
||
}
|
||
}</code></pre></div>
|
||
<p>You should instead use <a href="https://doc.rust-lang.org/1.93.1/core/mem/fn.replace.html" title="fn core::mem::replace"><code>std::mem::replace</code></a> to take the service that was ready:</p>
|
||
|
||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">struct </span>Wrapper<S> {
|
||
inner: S,
|
||
}
|
||
|
||
<span class="kw">impl</span><R, S> Service<R> <span class="kw">for </span>Wrapper<S>
|
||
<span class="kw">where
|
||
</span>S: Service<R> + Clone + <span class="lifetime">'static</span>,
|
||
R: <span class="lifetime">'static</span>,
|
||
{
|
||
<span class="kw">type </span>Response = S::Response;
|
||
<span class="kw">type </span>Error = S::Error;
|
||
<span class="kw">type </span>Future = Pin<Box<<span class="kw">dyn </span>Future<Output = <span class="prelude-ty">Result</span><<span class="self">Self</span>::Response, <span class="self">Self</span>::Error>>>>;
|
||
|
||
<span class="kw">fn </span>poll_ready(<span class="kw-2">&mut </span><span class="self">self</span>, cx: <span class="kw-2">&mut </span>Context<<span class="lifetime">'_</span>>) -> Poll<<span class="prelude-ty">Result</span><(), <span class="self">Self</span>::Error>> {
|
||
<span class="self">self</span>.inner.poll_ready(cx)
|
||
}
|
||
|
||
<span class="kw">fn </span>call(<span class="kw-2">&mut </span><span class="self">self</span>, req: R) -> <span class="self">Self</span>::Future {
|
||
<span class="kw">let </span>clone = <span class="self">self</span>.inner.clone();
|
||
<span class="comment">// take the service that was ready
|
||
</span><span class="kw">let </span><span class="kw-2">mut </span>inner = std::mem::replace(<span class="kw-2">&mut </span><span class="self">self</span>.inner, clone);
|
||
Box::pin(<span class="kw">async move </span>{
|
||
inner.call(req).<span class="kw">await
|
||
</span>})
|
||
}
|
||
}</code></pre></div></div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.Response" class="method"><a class="src rightside" href="../src/tower_service/lib.rs.html#313">Source</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a></h4></section></summary><div class="docblock"><p>Responses given by the service.</p>
|
||
</div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../src/tower_service/lib.rs.html#316">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a></h4></section></summary><div class="docblock"><p>Errors produced by the service.</p>
|
||
</div></details><details class="toggle" open><summary><section id="associatedtype.Future" class="method"><a class="src rightside" href="../src/tower_service/lib.rs.html#319">Source</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a>, Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>>></h4></section></summary><div class="docblock"><p>The future response value.</p>
|
||
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.poll_ready" class="method"><a class="src rightside" href="../src/tower_service/lib.rs.html#340">Source</a><h4 class="code-header">fn <a href="#tymethod.poll_ready" class="fn">poll_ready</a>(&mut self, cx: &mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>>></h4></section></summary><div class="docblock"><p>Returns <code>Poll::Ready(Ok(()))</code> when the service is able to process requests.</p>
|
||
<p>If the service is at capacity, then <code>Poll::Pending</code> is returned and the task
|
||
is notified when the service becomes ready again. This function is
|
||
expected to be called while on a task. Generally, this can be done with
|
||
a simple <code>futures::future::poll_fn</code> call.</p>
|
||
<p>If <code>Poll::Ready(Err(_))</code> is returned, the service is no longer able to service requests
|
||
and the caller should discard the service instance.</p>
|
||
<p>Once <code>poll_ready</code> returns <code>Poll::Ready(Ok(()))</code>, a request may be dispatched to the
|
||
service using <code>call</code>. Until a request is dispatched, repeated calls to
|
||
<code>poll_ready</code> must return either <code>Poll::Ready(Ok(()))</code> or <code>Poll::Ready(Err(_))</code>.</p>
|
||
<p>Note that <code>poll_ready</code> may reserve shared resources that are consumed in a subsequent
|
||
invocation of <code>call</code>. Thus, it is critical for implementations to not assume that <code>call</code>
|
||
will always be invoked and to ensure that such resources are released if the service is
|
||
dropped before <code>call</code> is invoked or the future returned by <code>call</code> is dropped before it
|
||
is polled.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.call" class="method"><a class="src rightside" href="../src/tower_service/lib.rs.html#355">Source</a><h4 class="code-header">fn <a href="#tymethod.call" class="fn">call</a>(&mut self, req: Request) -> Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a></h4></section></summary><div class="docblock"><p>Process the request and return the response asynchronously.</p>
|
||
<p>This function is expected to be callable off task. As such,
|
||
implementations should take care to not call <code>poll_ready</code>.</p>
|
||
<p>Before dispatching a request, <code>poll_ready</code> must be called and return
|
||
<code>Poll::Ready(Ok(()))</code>.</p>
|
||
<h5 id="panics"><a class="doc-anchor" href="#panics">§</a>Panics</h5>
|
||
<p>Implementations are permitted to panic if <code>call</code> is invoked without
|
||
obtaining <code>Poll::Ready(Ok(()))</code> from <code>poll_ready</code>.</p>
|
||
</div></details></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-%26mut+S" class="impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#358-360">Source</a><a href="#impl-Service%3CRequest%3E-for-%26mut+S" class="anchor">§</a><h3 class="code-header">impl<'a, S, Request> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.reference.html">&'a mut S</a><div class="where">where
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> + 'a,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#362">Source</a><a href="#associatedtype.Response-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a></h4></section><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#363">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a></h4></section><section id="associatedtype.Future-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#364">Source</a><a href="#associatedtype.Future-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a></h4></section><section id="method.poll_ready" class="method trait-impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#366">Source</a><a href="#method.poll_ready" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_ready" class="fn">poll_ready</a>(
|
||
&mut self,
|
||
cx: &mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>>></h4></section><section id="method.call" class="method trait-impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#370">Source</a><a href="#method.call" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.call" class="fn">call</a>(&mut self, request: Request) -> <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-Box%3CS%3E" class="impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#375-377">Source</a><a href="#impl-Service%3CRequest%3E-for-Box%3CS%3E" class="anchor">§</a><h3 class="code-header">impl<S, Request> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><S><div class="where">where
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> + ?<a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#379">Source</a><a href="#associatedtype.Response-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a></h4></section><section id="associatedtype.Error-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#380">Source</a><a href="#associatedtype.Error-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a></h4></section><section id="associatedtype.Future-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#381">Source</a><a href="#associatedtype.Future-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a></h4></section><section id="method.poll_ready-1" class="method trait-impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#383">Source</a><a href="#method.poll_ready-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.poll_ready" class="fn">poll_ready</a>(
|
||
&mut self,
|
||
cx: &mut <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/task/wake/struct.Context.html" title="struct core::task::wake::Context">Context</a><'_>,
|
||
) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/task/poll/enum.Poll.html" title="enum core::task::poll::Poll">Poll</a><<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/1.93.1/std/primitive.unit.html">()</a>, <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>>></h4></section><section id="method.call-1" class="method trait-impl"><a class="src rightside" href="../src/tower_service/lib.rs.html#387">Source</a><a href="#method.call-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.call" class="fn">call</a>(&mut self, request: Request) -> <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-Either%3CA,+B%3E" class="impl"><a class="src rightside" href="../src/tower/util/either.rs.html#27-57">Source</a><a href="#impl-Service%3CRequest%3E-for-Either%3CA,+B%3E" class="anchor">§</a><h3 class="code-header">impl<A, B, Request> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="enum" href="util/enum.Either.html" title="enum tower::util::Either">Either</a><A, B><div class="where">where
|
||
A: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>,
|
||
B: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request, Response = A::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a>, Error = A::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-3" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/either.rs.html#32">Source</a><a href="#associatedtype.Response-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <A as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a></h4></section><section id="associatedtype.Error-3" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/either.rs.html#33">Source</a><a href="#associatedtype.Error-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <A as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a></h4></section><section id="associatedtype.Future-3" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/either.rs.html#34">Source</a><a href="#associatedtype.Future-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="util/future/struct.EitherResponseFuture.html" title="struct tower::util::future::EitherResponseFuture">EitherResponseFuture</a><<A as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a>, <B as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CR%3E-for-FutureService%3CF,+S%3E" class="impl"><a class="src rightside" href="../src/tower/util/future_service.rs.html#143-172">Source</a><a href="#impl-Service%3CR%3E-for-FutureService%3CF,+S%3E" class="anchor">§</a><h3 class="code-header">impl<F, S, R, E> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><R> for <a class="struct" href="util/struct.FutureService.html" title="struct tower::util::FutureService">FutureService</a><F, S><div class="where">where
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S, E>> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a>,
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><R, Error = E>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-4" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/future_service.rs.html#148">Source</a><a href="#associatedtype.Response-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><R>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a></h4></section><section id="associatedtype.Error-4" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/future_service.rs.html#149">Source</a><a href="#associatedtype.Error-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Future-4" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/future_service.rs.html#150">Source</a><a href="#associatedtype.Future-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><R>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CTarget%3E-for-AsService%3C'_,+M,+Request%3E" class="impl"><a class="src rightside" href="../src/tower/make/make_service.rs.html#233-251">Source</a><a href="#impl-Service%3CTarget%3E-for-AsService%3C'_,+M,+Request%3E" class="anchor">§</a><h3 class="code-header">impl<M, S, Target, Request> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Target> for <a class="struct" href="make/struct.AsService.html" title="struct tower::make::AsService">AsService</a><'_, M, Request><div class="where">where
|
||
M: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Target, Response = S>,
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-5" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/make/make_service.rs.html#238">Source</a><a href="#associatedtype.Response-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <M as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Target>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a></h4></section><section id="associatedtype.Error-5" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/make/make_service.rs.html#239">Source</a><a href="#associatedtype.Error-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <M as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Target>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a></h4></section><section id="associatedtype.Future-5" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/make/make_service.rs.html#240">Source</a><a href="#associatedtype.Future-5" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <M as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Target>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CTarget%3E-for-IntoService%3CM,+Request%3E" class="impl"><a class="src rightside" href="../src/tower/make/make_service.rs.html#192-210">Source</a><a href="#impl-Service%3CTarget%3E-for-IntoService%3CM,+Request%3E" class="anchor">§</a><h3 class="code-header">impl<M, S, Target, Request> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Target> for <a class="struct" href="make/struct.IntoService.html" title="struct tower::make::IntoService">IntoService</a><M, Request><div class="where">where
|
||
M: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Target, Response = S>,
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-6" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/make/make_service.rs.html#197">Source</a><a href="#associatedtype.Response-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <M as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Target>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a></h4></section><section id="associatedtype.Error-6" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/make/make_service.rs.html#198">Source</a><a href="#associatedtype.Error-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <M as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Target>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a></h4></section><section id="associatedtype.Future-6" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/make/make_service.rs.html#199">Source</a><a href="#associatedtype.Future-6" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <M as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Target>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-Retry%3CP,+S%3E" class="impl"><a class="src rightside" href="../src/tower/retry/mod.rs.html#72-94">Source</a><a href="#impl-Service%3CRequest%3E-for-Retry%3CP,+S%3E" class="anchor">§</a><h3 class="code-header">impl<P, S, Request> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="struct" href="retry/struct.Retry.html" title="struct tower::retry::Retry">Retry</a><P, S><div class="where">where
|
||
P: <a class="trait" href="retry/trait.Policy.html" title="trait tower::retry::Policy">Policy</a><Request, S::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a>, S::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-7" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/retry/mod.rs.html#77">Source</a><a href="#associatedtype.Response-7" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a></h4></section><section id="associatedtype.Error-7" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/retry/mod.rs.html#78">Source</a><a href="#associatedtype.Error-7" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a></h4></section><section id="associatedtype.Future-7" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/retry/mod.rs.html#79">Source</a><a href="#associatedtype.Future-7" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="retry/future/struct.ResponseFuture.html" title="struct tower::retry::future::ResponseFuture">ResponseFuture</a><P, S, Request></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CR%3E-for-MapFuture%3CS,+F%3E" class="impl"><a class="src rightside" href="../src/tower/util/map_future.rs.html#49-67">Source</a><a href="#impl-Service%3CR%3E-for-MapFuture%3CS,+F%3E" class="anchor">§</a><h3 class="code-header">impl<R, S, F, T, E, Fut> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><R> for <a class="struct" href="util/struct.MapFuture.html" title="struct tower::util::MapFuture">MapFuture</a><S, F><div class="where">where
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><R>,
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(S::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a>) -> Fut,
|
||
E: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><S::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>>,
|
||
Fut: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, E>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-8" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_future.rs.html#56">Source</a><a href="#associatedtype.Response-8" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = T</h4></section><section id="associatedtype.Error-8" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_future.rs.html#57">Source</a><a href="#associatedtype.Error-8" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Future-8" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_future.rs.html#58">Source</a><a href="#associatedtype.Future-8" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = Fut</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CR1%3E-for-MapRequest%3CS,+F%3E" class="impl"><a class="src rightside" href="../src/tower/util/map_request.rs.html#43-61">Source</a><a href="#impl-Service%3CR1%3E-for-MapRequest%3CS,+F%3E" class="anchor">§</a><h3 class="code-header">impl<S, F, R1, R2> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><R1> for <a class="struct" href="util/struct.MapRequest.html" title="struct tower::util::MapRequest">MapRequest</a><S, F><div class="where">where
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><R2>,
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(R1) -> R2,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-9" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_request.rs.html#48">Source</a><a href="#associatedtype.Response-9" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><R2>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a></h4></section><section id="associatedtype.Error-9" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_request.rs.html#49">Source</a><a href="#associatedtype.Error-9" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><R2>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a></h4></section><section id="associatedtype.Future-9" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_request.rs.html#50">Source</a><a href="#associatedtype.Future-9" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><R2>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-MapErr%3CS,+F%3E" class="impl"><a class="src rightside" href="../src/tower/util/map_err.rs.html#59-77">Source</a><a href="#impl-Service%3CRequest%3E-for-MapErr%3CS,+F%3E" class="anchor">§</a><h3 class="code-header">impl<S, F, Request, Error> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="struct" href="util/struct.MapErr.html" title="struct tower::util::MapErr">MapErr</a><S, F><div class="where">where
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>,
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(S::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>) -> Error + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-10" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_err.rs.html#64">Source</a><a href="#associatedtype.Response-10" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a></h4></section><section id="associatedtype.Error-10" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_err.rs.html#65">Source</a><a href="#associatedtype.Error-10" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = Error</h4></section><section id="associatedtype.Future-10" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_err.rs.html#66">Source</a><a href="#associatedtype.Future-10" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="util/future/struct.MapErrFuture.html" title="struct tower::util::future::MapErrFuture">MapErrFuture</a><<S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a>, F></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-AndThen%3CS,+F%3E" class="impl"><a class="src rightside" href="../src/tower/util/and_then.rs.html#91-109">Source</a><a href="#impl-Service%3CRequest%3E-for-AndThen%3CS,+F%3E" class="anchor">§</a><h3 class="code-header">impl<S, F, Request, Fut> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="struct" href="util/struct.AndThen.html" title="struct tower::util::AndThen">AndThen</a><S, F><div class="where">where
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>,
|
||
S::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><Fut::<a class="associatedtype" href="../futures_core/future/trait.TryFuture.html#associatedtype.Error" title="type futures_core::future::TryFuture::Error">Error</a>>,
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(S::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a>) -> Fut + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
|
||
Fut: <a class="trait" href="../futures_core/future/trait.TryFuture.html" title="trait futures_core::future::TryFuture">TryFuture</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-11" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/and_then.rs.html#98">Source</a><a href="#associatedtype.Response-11" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <Fut as <a class="trait" href="../futures_core/future/trait.TryFuture.html" title="trait futures_core::future::TryFuture">TryFuture</a>>::<a class="associatedtype" href="../futures_core/future/trait.TryFuture.html#associatedtype.Ok" title="type futures_core::future::TryFuture::Ok">Ok</a></h4></section><section id="associatedtype.Error-11" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/and_then.rs.html#99">Source</a><a href="#associatedtype.Error-11" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <Fut as <a class="trait" href="../futures_core/future/trait.TryFuture.html" title="trait futures_core::future::TryFuture">TryFuture</a>>::<a class="associatedtype" href="../futures_core/future/trait.TryFuture.html#associatedtype.Error" title="type futures_core::future::TryFuture::Error">Error</a></h4></section><section id="associatedtype.Future-11" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/and_then.rs.html#100">Source</a><a href="#associatedtype.Future-11" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="util/future/struct.AndThenFuture.html" title="struct tower::util::future::AndThenFuture">AndThenFuture</a><<S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a>, Fut, F></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-MapResponse%3CS,+F%3E" class="impl"><a class="src rightside" href="../src/tower/util/map_response.rs.html#59-77">Source</a><a href="#impl-Service%3CRequest%3E-for-MapResponse%3CS,+F%3E" class="anchor">§</a><h3 class="code-header">impl<S, F, Request, Response> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="struct" href="util/struct.MapResponse.html" title="struct tower::util::MapResponse">MapResponse</a><S, F><div class="where">where
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>,
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(S::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a>) -> Response + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-12" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_response.rs.html#64">Source</a><a href="#associatedtype.Response-12" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = Response</h4></section><section id="associatedtype.Error-12" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_response.rs.html#65">Source</a><a href="#associatedtype.Error-12" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a></h4></section><section id="associatedtype.Future-12" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_response.rs.html#66">Source</a><a href="#associatedtype.Future-12" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="util/future/struct.MapResponseFuture.html" title="struct tower::util::future::MapResponseFuture">MapResponseFuture</a><<S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a>, F></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-MapResult%3CS,+F%3E" class="impl"><a class="src rightside" href="../src/tower/util/map_result.rs.html#59-78">Source</a><a href="#impl-Service%3CRequest%3E-for-MapResult%3CS,+F%3E" class="anchor">§</a><h3 class="code-header">impl<S, F, Request, Response, Error> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="struct" href="util/struct.MapResult.html" title="struct tower::util::MapResult">MapResult</a><S, F><div class="where">where
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>,
|
||
Error: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.From.html" title="trait core::convert::From">From</a><S::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>>,
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a>, S::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>>) -> <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Response, Error> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-13" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_result.rs.html#65">Source</a><a href="#associatedtype.Response-13" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = Response</h4></section><section id="associatedtype.Error-13" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_result.rs.html#66">Source</a><a href="#associatedtype.Error-13" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = Error</h4></section><section id="associatedtype.Future-13" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/map_result.rs.html#67">Source</a><a href="#associatedtype.Future-13" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="util/future/struct.MapResultFuture.html" title="struct tower::util::future::MapResultFuture">MapResultFuture</a><<S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a>, F></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-Then%3CS,+F%3E" class="impl"><a class="src rightside" href="../src/tower/util/then.rs.html#62-82">Source</a><a href="#impl-Service%3CRequest%3E-for-Then%3CS,+F%3E" class="anchor">§</a><h3 class="code-header">impl<S, F, Request, Response, Error, Fut> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="struct" href="util/struct.Then.html" title="struct tower::util::Then">Then</a><S, F><div class="where">where
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>,
|
||
S::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><Error>,
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnOnce.html" title="trait core::ops::function::FnOnce">FnOnce</a>(<a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><S::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a>, S::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>>) -> Fut + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,
|
||
Fut: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Response, Error>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-14" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/then.rs.html#69">Source</a><a href="#associatedtype.Response-14" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = Response</h4></section><section id="associatedtype.Error-14" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/then.rs.html#70">Source</a><a href="#associatedtype.Error-14" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = Error</h4></section><section id="associatedtype.Future-14" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/then.rs.html#71">Source</a><a href="#associatedtype.Future-14" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="util/future/struct.ThenFuture.html" title="struct tower::util::future::ThenFuture">ThenFuture</a><<S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a>, Fut, F></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-Timeout%3CS%3E" class="impl"><a class="src rightside" href="../src/tower/timeout/mod.rs.html#48-70">Source</a><a href="#impl-Service%3CRequest%3E-for-Timeout%3CS%3E" class="anchor">§</a><h3 class="code-header">impl<S, Request> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="struct" href="timeout/struct.Timeout.html" title="struct tower::timeout::Timeout">Timeout</a><S><div class="where">where
|
||
S: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>,
|
||
S::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="type" href="type.BoxError.html" title="type tower::BoxError">BoxError</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-15" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/timeout/mod.rs.html#53">Source</a><a href="#associatedtype.Response-15" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a></h4></section><section id="associatedtype.Error-15" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/timeout/mod.rs.html#54">Source</a><a href="#associatedtype.Error-15" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>></h4></section><section id="associatedtype.Future-15" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/timeout/mod.rs.html#55">Source</a><a href="#associatedtype.Future-15" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="timeout/future/struct.ResponseFuture.html" title="struct tower::timeout::future::ResponseFuture">ResponseFuture</a><<S as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CT%3E-for-Shared%3CS%3E" class="impl"><a class="src rightside" href="../src/tower/make/make_service/shared.rs.html#83-98">Source</a><a href="#impl-Service%3CT%3E-for-Shared%3CS%3E" class="anchor">§</a><h3 class="code-header">impl<S, T> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><T> for <a class="struct" href="make/struct.Shared.html" title="struct tower::make::Shared">Shared</a><S><div class="where">where
|
||
S: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-16" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/make/make_service/shared.rs.html#87">Source</a><a href="#associatedtype.Response-16" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = S</h4></section><section id="associatedtype.Error-16" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/make/make_service/shared.rs.html#88">Source</a><a href="#associatedtype.Error-16" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></section><section id="associatedtype.Future-16" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/make/make_service/shared.rs.html#89">Source</a><a href="#associatedtype.Future-16" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="make/future/struct.SharedFuture.html" title="struct tower::make::future::SharedFuture">SharedFuture</a><S></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-ServiceFn%3CT%3E" class="impl"><a class="src rightside" href="../src/tower/util/service_fn.rs.html#66-82">Source</a><a href="#impl-Service%3CRequest%3E-for-ServiceFn%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T, F, Request, R, E> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="struct" href="util/struct.ServiceFn.html" title="struct tower::util::ServiceFn">ServiceFn</a><T><div class="where">where
|
||
T: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Request) -> F,
|
||
F: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><R, E>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-17" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/service_fn.rs.html#71">Source</a><a href="#associatedtype.Response-17" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = R</h4></section><section id="associatedtype.Error-17" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/service_fn.rs.html#72">Source</a><a href="#associatedtype.Error-17" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Future-17" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/service_fn.rs.html#73">Source</a><a href="#associatedtype.Future-17" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = F</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CRequest%3E-for-Optional%3CT%3E" class="impl"><a class="src rightside" href="../src/tower/util/optional/mod.rs.html#35-59">Source</a><a href="#impl-Service%3CRequest%3E-for-Optional%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T, Request> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request> for <a class="struct" href="util/struct.Optional.html" title="struct tower::util::Optional">Optional</a><T><div class="where">where
|
||
T: <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>,
|
||
T::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type tower::Service::Error">Error</a>: <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="type" href="type.BoxError.html" title="type tower::BoxError">BoxError</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-18" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/optional/mod.rs.html#40">Source</a><a href="#associatedtype.Response-18" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = <T as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type tower::Service::Response">Response</a></h4></section><section id="associatedtype.Error-18" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/optional/mod.rs.html#41">Source</a><a href="#associatedtype.Error-18" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = <a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/error/trait.Error.html" title="trait core::error::Error">Error</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>></h4></section><section id="associatedtype.Future-18" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/optional/mod.rs.html#42">Source</a><a href="#associatedtype.Future-18" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="util/future/optional/struct.ResponseFuture.html" title="struct tower::util::future::optional::ResponseFuture">ResponseFuture</a><<T as <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><Request>>::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type tower::Service::Future">Future</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CT%3E-for-BoxCloneService%3CT,+U,+E%3E" class="impl"><a class="src rightside" href="../src/tower/util/boxed_clone.rs.html#89-103">Source</a><a href="#impl-Service%3CT%3E-for-BoxCloneService%3CT,+U,+E%3E" class="anchor">§</a><h3 class="code-header">impl<T, U, E> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><T> for <a class="struct" href="util/struct.BoxCloneService.html" title="struct tower::util::BoxCloneService">BoxCloneService</a><T, U, E></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-19" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed_clone.rs.html#90">Source</a><a href="#associatedtype.Response-19" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = U</h4></section><section id="associatedtype.Error-19" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed_clone.rs.html#91">Source</a><a href="#associatedtype.Error-19" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Future-19" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed_clone.rs.html#92">Source</a><a href="#associatedtype.Future-19" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, E>> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CT%3E-for-BoxCloneSyncService%3CT,+U,+E%3E" class="impl"><a class="src rightside" href="../src/tower/util/boxed_clone_sync.rs.html#49-63">Source</a><a href="#impl-Service%3CT%3E-for-BoxCloneSyncService%3CT,+U,+E%3E" class="anchor">§</a><h3 class="code-header">impl<T, U, E> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><T> for <a class="struct" href="util/struct.BoxCloneSyncService.html" title="struct tower::util::BoxCloneSyncService">BoxCloneSyncService</a><T, U, E></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-20" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed_clone_sync.rs.html#50">Source</a><a href="#associatedtype.Response-20" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = U</h4></section><section id="associatedtype.Error-20" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed_clone_sync.rs.html#51">Source</a><a href="#associatedtype.Error-20" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Future-20" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed_clone_sync.rs.html#52">Source</a><a href="#associatedtype.Future-20" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, E>> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CT%3E-for-BoxService%3CT,+U,+E%3E" class="impl"><a class="src rightside" href="../src/tower/util/boxed/sync.rs.html#86-98">Source</a><a href="#impl-Service%3CT%3E-for-BoxService%3CT,+U,+E%3E" class="anchor">§</a><h3 class="code-header">impl<T, U, E> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><T> for <a class="struct" href="util/struct.BoxService.html" title="struct tower::util::BoxService">BoxService</a><T, U, E></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-21" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed/sync.rs.html#87">Source</a><a href="#associatedtype.Response-21" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = U</h4></section><section id="associatedtype.Error-21" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed/sync.rs.html#88">Source</a><a href="#associatedtype.Error-21" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Future-21" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed/sync.rs.html#89">Source</a><a href="#associatedtype.Future-21" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, E>> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Service%3CT%3E-for-UnsyncBoxService%3CT,+U,+E%3E" class="impl"><a class="src rightside" href="../src/tower/util/boxed/unsync.rs.html#50-62">Source</a><a href="#impl-Service%3CT%3E-for-UnsyncBoxService%3CT,+U,+E%3E" class="anchor">§</a><h3 class="code-header">impl<T, U, E> <a class="trait" href="trait.Service.html" title="trait tower::Service">Service</a><T> for <a class="struct" href="util/struct.UnsyncBoxService.html" title="struct tower::util::UnsyncBoxService">UnsyncBoxService</a><T, U, E></h3></section></summary><div class="impl-items"><section id="associatedtype.Response-22" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed/unsync.rs.html#51">Source</a><a href="#associatedtype.Response-22" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Response" class="associatedtype">Response</a> = U</h4></section><section id="associatedtype.Error-22" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed/unsync.rs.html#52">Source</a><a href="#associatedtype.Error-22" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = E</h4></section><section id="associatedtype.Future-22" class="associatedtype trait-impl"><a class="src rightside" href="../src/tower/util/boxed/unsync.rs.html#53">Source</a><a href="#associatedtype.Future-22" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = <a class="struct" href="https://doc.rust-lang.org/1.93.1/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/1.93.1/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, E>>>></h4></section></div></details></div><script src="../trait.impl/tower_service/trait.Service.js" data-ignore-extern-crates="alloc" async></script></section></div></main></body></html> |