Files
GopherGate/target/doc/hyper/service/trait.HttpService.html
2026-02-26 12:00:21 -05:00

23 lines
14 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 `Request` to `Response`."><title>HttpService in hyper::service - 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="hyper" 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="#">HttpService</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../hyper/index.html">hyper</a><span class="version">1.8.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Http<wbr>Service</a></h2><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.ResBody" title="ResBody">ResBody</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In hyper::<wbr>service</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">hyper</a>::<wbr><a href="index.html">service</a></div><h1>Trait <span class="trait">Http<wbr>Service</span>&nbsp;<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/hyper/service/http.rs.html#20-38">Source</a> </span></div><pre class="rust item-decl"><code>pub trait HttpService&lt;ReqBody&gt;: Sealed&lt;ReqBody&gt; {
type <a href="#associatedtype.ResBody" class="associatedtype">ResBody</a>: <a class="trait" href="../body/trait.Body.html" title="trait hyper::body::Body">Body</a>;
type <a href="#associatedtype.Error" class="associatedtype">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>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/error/trait.Error.html" title="trait core::error::Error">StdError</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> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>&gt;&gt;;
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>&lt;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>&lt;<a class="struct" href="../../http/response/struct.Response.html" title="struct http::response::Response">Response</a>&lt;Self::<a class="associatedtype" href="trait.HttpService.html#associatedtype.ResBody" title="type hyper::service::HttpService::ResBody">ResBody</a>&gt;, Self::<a class="associatedtype" href="trait.HttpService.html#associatedtype.Error" title="type hyper::service::HttpService::Error">Error</a>&gt;&gt;;
}</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 href="../../http/request/struct.Request.html" title="struct http::request::Request"><code>Request</code></a> to <a href="../../http/response/struct.Response.html" title="struct http::response::Response"><code>Response</code></a>.</p>
<p>This is a <em>sealed</em> trait, meaning that it can not be implemented directly. Rather, it is an
alias for <a href="trait.Service.html" title="trait hyper::service::Service"><code>Service</code></a>s that accept a <a href="../../http/request/struct.Request.html" title="struct http::request::Request"><code>Request</code></a> and return a <a href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future"><code>Future</code></a> that resolves to a
<a href="../../http/response/struct.Response.html" title="struct http::response::Response"><code>Response</code></a>. External callers should implement <a href="trait.Service.html" title="trait hyper::service::Service"><code>Service</code></a> instead.</p>
<p>Rather than being generic over the request and response, this trait is generic across the
request <a href="../body/trait.Body.html" title="trait hyper::body::Body"><code>Body</code></a> and response <a href="../body/trait.Body.html" title="trait hyper::body::Body"><code>Body</code></a>.</p>
<p>See the crate-level <a href="index.html" title="mod hyper::service"><code>service</code></a> documentation for more information.</p>
<p>See <a href="trait.Service.html" title="trait hyper::service::Service"><code>Service</code></a> for more information.</p>
</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.ResBody" class="method"><a class="src rightside" href="../../src/hyper/service/http.rs.html#22">Source</a><h4 class="code-header">type <a href="#associatedtype.ResBody" class="associatedtype">ResBody</a>: <a class="trait" href="../body/trait.Body.html" title="trait hyper::body::Body">Body</a></h4></section></summary><div class="docblock"><p>The <a href="../body/trait.Body.html" title="trait hyper::body::Body"><code>Body</code></a> body of the <a href="../../http/response/struct.Response.html" title="struct http::response::Response"><code>Response</code></a>.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.Error" class="method"><a class="src rightside" href="../../src/hyper/service/http.rs.html#31">Source</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">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>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/error/trait.Error.html" title="trait core::error::Error">StdError</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> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>The error type that can occur within this <a href="trait.Service.html" title="trait hyper::service::Service"><code>Service</code></a>.</p>
<p>Note: Returning an <code>Error</code> to a hyper server, the behavior depends on the protocol. In
most cases, hyper will cause the connection to be abruptly aborted. In most cases, it is
better to return a <code>Response</code> with a 4xx or 5xx status code.</p>
<p>See <a href="trait.Service.html#associatedtype.Error" title="associated type hyper::service::Service::Error"><code>Service::Error</code></a> for more information.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.Future" class="method"><a class="src rightside" href="../../src/hyper/service/http.rs.html#34">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>&lt;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>&lt;<a class="struct" href="../../http/response/struct.Response.html" title="struct http::response::Response">Response</a>&lt;Self::<a class="associatedtype" href="trait.HttpService.html#associatedtype.ResBody" title="type hyper::service::HttpService::ResBody">ResBody</a>&gt;, Self::<a class="associatedtype" href="trait.HttpService.html#associatedtype.Error" title="type hyper::service::HttpService::Error">Error</a>&gt;&gt;</h4></section></summary><div class="docblock"><p>The <a href="https://doc.rust-lang.org/1.93.1/core/future/future/trait.Future.html" title="trait core::future::future::Future"><code>Future</code></a> returned by this <a href="trait.Service.html" title="trait hyper::service::Service"><code>Service</code></a>.</p>
</div></details></div><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-HttpService%3CB1%3E-for-T" class="impl"><a class="src rightside" href="../../src/hyper/service/http.rs.html#40-54">Source</a><a href="#impl-HttpService%3CB1%3E-for-T" class="anchor">§</a><h3 class="code-header">impl&lt;T, B1, B2&gt; <a class="trait" href="trait.HttpService.html" title="trait hyper::service::HttpService">HttpService</a>&lt;B1&gt; for T<div class="where">where
T: <a class="trait" href="trait.Service.html" title="trait hyper::service::Service">Service</a>&lt;<a class="struct" href="../../http/request/struct.Request.html" title="struct http::request::Request">Request</a>&lt;B1&gt;, Response = <a class="struct" href="../../http/response/struct.Response.html" title="struct http::response::Response">Response</a>&lt;B2&gt;&gt;,
B2: <a class="trait" href="../body/trait.Body.html" title="trait hyper::body::Body">Body</a>,
T::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type hyper::service::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>&lt;<a class="struct" href="https://doc.rust-lang.org/1.93.1/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/error/trait.Error.html" title="trait core::error::Error">StdError</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> + <a class="trait" href="https://doc.rust-lang.org/1.93.1/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>&gt;&gt;,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.ResBody-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/hyper/service/http.rs.html#46">Source</a><a href="#associatedtype.ResBody-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.ResBody" class="associatedtype">ResBody</a> = B2</h4></section><section id="associatedtype.Error-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/hyper/service/http.rs.html#48">Source</a><a href="#associatedtype.Error-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Error" class="associatedtype">Error</a> = &lt;T as <a class="trait" href="trait.Service.html" title="trait hyper::service::Service">Service</a>&lt;<a class="struct" href="../../http/request/struct.Request.html" title="struct http::request::Request">Request</a>&lt;B1&gt;&gt;&gt;::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type hyper::service::Service::Error">Error</a></h4></section><section id="associatedtype.Future-1" class="associatedtype trait-impl"><a class="src rightside" href="../../src/hyper/service/http.rs.html#49">Source</a><a href="#associatedtype.Future-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Future" class="associatedtype">Future</a> = &lt;T as <a class="trait" href="trait.Service.html" title="trait hyper::service::Service">Service</a>&lt;<a class="struct" href="../../http/request/struct.Request.html" title="struct http::request::Request">Request</a>&lt;B1&gt;&gt;&gt;::<a class="associatedtype" href="trait.Service.html#associatedtype.Future" title="type hyper::service::Service::Future">Future</a></h4></section></div></details></div><script src="../../trait.impl/hyper/service/http/trait.HttpService.js" async></script></section></div></main></body></html>