mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 17:52:56 +01:00
62 lines
43 KiB
HTML
62 lines
43 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="Trait implemented by types that can be converted to an HTTP response."><title>Responder in actix_web - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-dd39b87e5fcfba68.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_web" data-themes="" data-resource-suffix="" data-rustdoc-version="1.80.0-nightly (bdbbb6c6a 2024-05-26)" data-channel="nightly" data-search-js="search-d52510db62a78183.js" data-settings-js="settings-4313503d2e1961c2.js" ><script src="../static.files/storage-118b08c4c78b968e.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-20a3ad099b048cf2.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-df360f571f6edeae.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></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]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../actix_web/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_web/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_web/index.html">actix_web</a><span class="version">4.6.0</span></h2></div><h2 class="location"><a href="#">Responder</a></h2><div class="sidebar-elems"><section><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.Body">Body</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.respond_to">respond_to</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.customize">customize</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-Responder-for-%26%5Bu8%5D">&'static [u8]</a></li><li><a href="#impl-Responder-for-%26str">&'static str</a></li><li><a href="#impl-Responder-for-%26String">&String</a></li><li><a href="#impl-Responder-for-(R,+StatusCode)">(R, StatusCode)</a></li><li><a href="#impl-Responder-for-ByteString">ByteString</a></li><li><a href="#impl-Responder-for-Cow%3C'_,+str%3E">Cow<'_, str></a></li><li><a href="#impl-Responder-for-Option%3CR%3E">Option<R></a></li><li><a href="#impl-Responder-for-ResponseBuilder">ResponseBuilder</a></li><li><a href="#impl-Responder-for-Result%3CR,+E%3E">Result<R, E></a></li><li><a href="#impl-Responder-for-String">String</a></li><li><a href="#impl-Responder-for-Vec%3Cu8%3E">Vec<u8></a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In crate actix_web</a></h2></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><h1>Trait <a href="index.html">actix_web</a>::<wbr><a class="trait" href="#">Responder</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="
|
||
|
type <a href="#associatedtype.Body" class="associatedtype">Body</a>: <a class="trait" href="body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a> + 'static;
|
||
|
|
||
|
// Required method
|
||
|
fn <a href="#tymethod.respond_to" class="fn">respond_to</a>(self, req: &<a class="struct" href="struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a>) -> <a class="struct" href="struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</a><Self::<a class="associatedtype" href="trait.Responder.html#associatedtype.Body" title="type actix_web::Responder::Body">Body</a>>;
|
||
|
|
||
|
// Provided method
|
||
|
fn <a href="#method.customize" class="fn">customize</a>(self) -> <a class="struct" href="struct.CustomizeResponder.html" title="struct actix_web::CustomizeResponder">CustomizeResponder</a><Self>
|
||
|
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a></span> { ... }
|
||
|
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait implemented by types that can be converted to an HTTP response.</p>
|
||
|
<p>Any types that implement this trait can be used in the return type of a handler. Since handlers
|
||
|
will only have one return type, it is idiomatic to use opaque return types <code>-> impl Responder</code>.</p>
|
||
|
<h2 id="implementations-1"><a class="doc-anchor" href="#implementations-1">§</a>Implementations</h2>
|
||
|
<p>It is often not required to implement <code>Responder</code> for your own types due to a broad base of
|
||
|
built-in implementations:</p>
|
||
|
<ul>
|
||
|
<li><code>HttpResponse</code> and <code>HttpResponseBuilder</code></li>
|
||
|
<li><code>Option<R></code> where <code>R: Responder</code></li>
|
||
|
<li><code>Result<R, E></code> where <code>R: Responder</code> and <a href="error/trait.ResponseError.html" title="trait actix_web::error::ResponseError"><code>E: ResponseError</code></a></li>
|
||
|
<li><code>(R, StatusCode)</code> where <code>R: Responder</code></li>
|
||
|
<li><code>&'static str</code>, <code>String</code>, <code>&'_ String</code>, <code>Cow<'_, str></code>, <a href="bytestring::ByteString"><code>ByteString</code></a></li>
|
||
|
<li><code>&'static [u8]</code>, <code>Vec<u8></code>, <code>Bytes</code>, <code>BytesMut</code></li>
|
||
|
<li><a href="web/struct.Json.html" title="struct actix_web::web::Json"><code>Json<T></code></a> and <a href="web/struct.Form.html" title="struct actix_web::web::Form"><code>Form<T></code></a> where <code>T: Serialize</code></li>
|
||
|
<li><a href="web/enum.Either.html" title="enum actix_web::web::Either"><code>Either<L, R></code></a> where <code>L: Serialize</code> and <code>R: Serialize</code></li>
|
||
|
<li><a href="struct.CustomizeResponder.html" title="struct actix_web::CustomizeResponder"><code>CustomizeResponder<R></code></a></li>
|
||
|
<li><a href="https://docs.rs/actix-files/latest/actix_files/struct.NamedFile.html"><code>actix_files::NamedFile</code></a></li>
|
||
|
<li><a href="https://docs.rs/actix-web-lab/latest/actix_web_lab/respond/index.html">Experimental responders from <code>actix-web-lab</code></a></li>
|
||
|
<li>Third party integrations may also have implemented <code>Responder</code> where appropriate. For example,
|
||
|
HTML templating engines.</li>
|
||
|
</ul>
|
||
|
<h2 id="customizing-responder-output"><a class="doc-anchor" href="#customizing-responder-output">§</a>Customizing Responder Output</h2>
|
||
|
<p>Calling <a href="trait.Responder.html#method.customize" title="method actix_web::Responder::customize"><code>.customize()</code></a> on any responder type will wrap it in a
|
||
|
<a href="struct.CustomizeResponder.html" title="struct actix_web::CustomizeResponder"><code>CustomizeResponder</code></a> capable of overriding various parts of the response such as the status
|
||
|
code and header map.</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"><section id="associatedtype.Body" class="method"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#40">source</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a>: <a class="trait" href="body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a> + 'static</h4></section></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.respond_to" class="method"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#43">source</a><h4 class="code-header">fn <a href="#tymethod.respond_to" class="fn">respond_to</a>(self, req: &<a class="struct" href="struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a>) -> <a class="struct" href="struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</a><Self::<a class="associatedtype" href="trait.Responder.html#associatedtype.Body" title="type actix_web::Responder::Body">Body</a>></h4></section></summary><div class="docblock"><p>Convert self to <code>HttpResponse</code>.</p>
|
||
|
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.customize" class="method"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#64-69">source</a><h4 class="code-header">fn <a href="#method.customize" class="fn">customize</a>(self) -> <a class="struct" href="struct.CustomizeResponder.html" title="struct actix_web::CustomizeResponder">CustomizeResponder</a><Self><div class="where">where
|
||
|
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,</div></h4></section></summary><div class="docblock"><p>Wraps responder to allow alteration of its response.</p>
|
||
|
<p>See <a href="struct.CustomizeResponder.html" title="struct actix_web::CustomizeResponder"><code>CustomizeResponder</code></a> docs for more details on its capabilities.</p>
|
||
|
<h5 id="examples"><a class="doc-anchor" href="#examples">§</a>Examples</h5>
|
||
|
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use </span>actix_web::{Responder, http::StatusCode, test::TestRequest};
|
||
|
|
||
|
<span class="kw">let </span>responder = <span class="string">"Hello world!"
|
||
|
</span>.customize()
|
||
|
.with_status(StatusCode::BAD_REQUEST)
|
||
|
.insert_header((<span class="string">"x-hello"</span>, <span class="string">"world"</span>));
|
||
|
|
||
|
<span class="kw">let </span>request = TestRequest::default().to_http_request();
|
||
|
<span class="kw">let </span>response = responder.respond_to(<span class="kw-2">&</span>request);
|
||
|
<span class="macro">assert_eq!</span>(response.status(), StatusCode::BAD_REQUEST);
|
||
|
<span class="macro">assert_eq!</span>(response.headers().get(<span class="string">"x-hello"</span>).unwrap(), <span class="string">"world"</span>);</code></pre></div>
|
||
|
</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-Responder-for-%26str" class="impl"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#166">source</a><a href="#impl-Responder-for-%26str" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a> for &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Body-1" class="associatedtype trait-impl"><a href="#associatedtype.Body-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a> = &'static <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></section><section id="method.respond_to" class="method trait-impl"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#166">source</a><a href="#method.respond_to" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.respond_to" class="fn">respond_to</a>(self, _: &<a class="struct" href="struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a>) -> <a class="struct" href="struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</a><Self::<a class="associatedtype" href="trait.Responder.html#associatedtype.Body" title="type actix_web::Responder::Body">Body</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Responder-for-%26%5Bu8%5D" class="impl"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#161">source</a><a href="#impl-Responder-for-%26%5Bu8%5D" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a> for &'static [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]</h3></section></summary><div class="impl-items"><section id="associatedtype.Body-2" class="associatedtype trait-impl"><a href="#associatedtype.Body-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a> = &'static [<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>]</h4></section><section id="method.respond_to-1" class="method trait-impl"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#161">source</a><a href="#method.respond_to-1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.respond_to" class="fn">respond_to</a>(self, _: &<a class="struct" href="struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a>) -> <a class="struct" href="struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</a><Self::<a class="associatedtype" href="trait.Responder.html#associatedtype.Body" title="type actix_web::Responder::Body">Body</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Responder-for-%26String" class="impl"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#184">source</a><a href="#impl-Responder-for-%26String" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a> for &<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Body-3" class="associatedtype trait-impl"><a href="#associatedtype.Body-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a> = <a class="struct" href="https:/
|
||
|
R: <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a>,
|
||
|
E: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><<a class="struct" href="error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Body-9" class="associatedtype trait-impl"><a href="#associatedtype.Body-9" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a> = <a class="enum" href="body/enum.EitherBody.html" title="enum actix_web::body::EitherBody">EitherBody</a><<R as <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a>>::<a class="associatedtype" href="trait.Responder.html#associatedtype.Body" title="type actix_web::Responder::Body">Body</a>></h4></section><section id="method.respond_to-8" class="method trait-impl"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#126-131">source</a><a href="#method.respond_to-8" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.respond_to" class="fn">respond_to</a>(self, req: &<a class="struct" href="struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a>) -> <a class="struct" href="struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</a><Self::<a class="associatedtype" href="trait.Responder.html#associatedtype.Body" title="type actix_web::Responder::Body">Body</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Responder-for-(R,+StatusCode)" class="impl"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#134-142">source</a><a href="#impl-Responder-for-(R,+StatusCode)" class="anchor">§</a><h3 class="code-header">impl<R: <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a>> <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a> for (R, <a class="struct" href="http/struct.StatusCode.html" title="struct actix_web::http::StatusCode">StatusCode</a>)</h3></section></summary><div class="impl-items"><section id="associatedtype.Body-10" class="associatedtype trait-impl"><a href="#associatedtype.Body-10" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a> = <R as <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a>>::<a class="associatedtype" href="trait.Responder.html#associatedtype.Body" title="type actix_web::Responder::Body">Body</a></h4></section><section id="method.respond_to-9" class="method trait-impl"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#137-141">source</a><a href="#method.respond_to-9" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.respond_to" class="fn">respond_to</a>(self, req: &<a class="struct" href="struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a>) -> <a class="struct" href="struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</a><Self::<a class="associatedtype" href="trait.Responder.html#associatedtype.Body" title="type actix_web::Responder::Body">Body</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Responder-for-Option%3CR%3E" class="impl"><a class="src rightside" href="../src/actix_web/response/responder.rs.html#108-117">source</a><a href="#impl-Responder-for-Option%3CR%3E" class="anchor">§</a><h3 class="code-header">impl<R: <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a>> <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a> for <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><R></h3></section></summary><div class="impl-items"><section id="associa
|
||
|
B: <a class="trait" href="body/trait.MessageBody.html" title="trait actix_web::body::MessageBody">MessageBody</a> + 'static,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Body-17" class="associatedtype trait-impl"><a href="#associatedtype.Body-17" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a> = B</h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Responder-for-Either%3CL,+R%3E" class="impl"><a class="src rightside" href="../src/actix_web/types/either.rs.html#125-138">source</a><a href="#impl-Responder-for-Either%3CL,+R%3E" class="anchor">§</a><h3 class="code-header">impl<L, R> <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a> for <a class="enum" href="web/enum.Either.html" title="enum actix_web::web::Either">Either</a><L, R><div class="where">where
|
||
|
L: <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a>,
|
||
|
R: <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a>,</div></h3></section></summary><div class="docblock"><p>See <a href="#responder">here</a> for example of usage as a handler return type.</p>
|
||
|
</div><div class="impl-items"><section id="associatedtype.Body-18" class="associatedtype trait-impl"><a href="#associatedtype.Body-18" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a> = <a class="enum" href="body/enum.EitherBody.html" title="enum actix_web::body::EitherBody">EitherBody</a><<L as <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a>>::<a class="associatedtype" href="trait.Responder.html#associatedtype.Body" title="type actix_web::Responder::Body">Body</a>, <R as <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a>>::<a class="associatedtype" href="trait.Responder.html#associatedtype.Body" title="type actix_web::Responder::Body">Body</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Responder-for-InternalError%3CT%3E" class="impl"><a class="src rightside" href="../src/actix_web/error/internal.rs.html#108-117">source</a><a href="#impl-Responder-for-InternalError%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a> for <a class="struct" href="error/struct.InternalError.html" title="struct actix_web::error::InternalError">InternalError</a><T><div class="where">where
|
||
|
T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + 'static,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Body-19" class="associatedtype trait-impl"><a href="#associatedtype.Body-19" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a> = <a class="struct" href="body/struct.BoxBody.html" title="struct actix_web::body::BoxBody">BoxBody</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Responder-for-CustomizeResponder%3CT%3E" class="impl"><a class="src rightside" href="../src/actix_web/response/customize_responder.rs.html#142-169">source</a><a href="#impl-Responder-for-CustomizeResponder%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T> <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a> for <a class="struct" href="struct.CustomizeResponder.html" title="struct actix_web::CustomizeResponder">CustomizeResponder</a><T><div class="where">where
|
||
|
T: <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a>,</div></h3></section></summary><div class="impl-items"><section id="associatedtype.Body-20" class="associatedtype trait-impl"><a href="#associatedtype.Body-20" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a> = <a class="enum" href="body/enum.EitherBody.html" title="enum actix_web::body::EitherBody">EitherBody</a><<T as <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a>>::<a class="associatedtype" href="trait.Responder.html#associatedtype.Body" title="type actix_web::Responder::Body">Body</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Responder-for-Form%3CT%3E" class="impl"><a class="src rightside" href="../src/actix_web/types/form.rs.html#181-199">source</a><a href="#impl-Responder-for-Form%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://docs.rs/serde/1.0.203/serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a>> <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a> for <a class="struct" href="web/struct.Form.html" title="struct actix_web::web::Form">Form</a><T></h3></section></summary><div class="docblock"><p>See <a href="#responder">here</a> for example of usage as a handler return type.</p>
|
||
|
</div><div class="impl-items"><section id="associatedtype.Body-21" class="associatedtype trait-impl"><a href="#associatedtype.Body-21" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a> = <a class="enum" href="body/enum.EitherBody.html" title="enum actix_web::body::EitherBody">EitherBody</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-Responder-for-Json%3CT%3E" class="impl"><a class="src rightside" href="../src/actix_web/types/json.rs.html#118-136">source</a><a href="#impl-Responder-for-Json%3CT%3E" class="anchor">§</a><h3 class="code-header">impl<T: <a class="trait" href="https://docs.rs/serde/1.0.203/serde/ser/trait.Serialize.html" title="trait serde::ser::Serialize">Serialize</a>> <a class="trait" href="trait.Responder.html" title="trait actix_web::Responder">Responder</a> for <a class="struct" href="web/struct.Json.html" title="struct actix_web::web::Json">Json</a><T></h3></section></summary><div class="docblock"><p>Creates response with OK status code, correct content type header, and serialized JSON payload.</p>
|
||
|
<p>If serialization failed</p>
|
||
|
</div><div class="impl-items"><section id="associatedtype.Body-22" class="associatedtype trait-impl"><a href="#associatedtype.Body-22" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Body" class="associatedtype">Body</a> = <a class="enum" href="body/enum.EitherBody.html" title="enum actix_web::body::EitherBody">EitherBody</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>></h4></section></div></details></div><script src="../trait.impl/actix_web/response/responder/trait.Responder.js" data-ignore-extern-crates="alloc,core,bytes,actix_http,std,bytestring" async></script></section></div></main></body></html>
|