mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-27 17:52:56 +01:00
16 lines
25 KiB
HTML
16 lines
25 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="Errors that can generate responses."><title>ResponseError in actix_web::error - 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="#">ResponseError</a></h2><div class="sidebar-elems"><section><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.error_response">error_response</a></li><li><a href="#method.status_code">status_code</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-ResponseError-for-Box%3Cdyn+Error%3E">Box<dyn StdError + 'static></a></li><li><a href="#impl-ResponseError-for-Error">Error</a></li><li><a href="#impl-ResponseError-for-Error">Error</a></li><li><a href="#impl-ResponseError-for-Error">Error</a></li><li><a href="#impl-ResponseError-for-Error">Error</a></li><li><a href="#impl-ResponseError-for-Error">Error</a></li><li><a href="#impl-ResponseError-for-HandshakeError">HandshakeError</a></li><li><a href="#impl-ResponseError-for-Infallible">Infallible</a></li><li><a href="#impl-ResponseError-for-ProtocolError">ProtocolError</a></li><li><a href="#impl-ResponseError-for-Utf8Error">Utf8Error</a></li></ul><h3><a href="#implementations">Methods</a></h3><ul class="block method"><li><a href="#method.downcast_mut">downcast_mut</a></li><li><a href="#method.downcast_ref">downcast_ref</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><h2><a href="index.html">In actix_web::error</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 href="index.html">error</a>::<wbr><a class="trait" href="#">ResponseError</a><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><span class="out-of-band"><a class="src" href="../../src/actix_web/error/response_error.rs.html#26-52">sour
|
|||
|
// Provided methods
|
|||
|
fn <a href="#method.status_code" class="fn">status_code</a>(&self) -> <a class="struct" href="../http/struct.StatusCode.html" title="struct actix_web::http::StatusCode">StatusCode</a> { ... }
|
|||
|
<span class="item-spacer"></span> fn <a href="#method.error_response" class="fn">error_response</a>(&self) -> <a class="struct" href="../struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</a><<a class="struct" href="../body/struct.BoxBody.html" title="struct actix_web::body::BoxBody">BoxBody</a>> { ... }
|
|||
|
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Errors that can generate responses.</p>
|
|||
|
</div></details><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.status_code" class="method"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#31-33">source</a><h4 class="code-header">fn <a href="#method.status_code" class="fn">status_code</a>(&self) -> <a class="struct" href="../http/struct.StatusCode.html" title="struct actix_web::http::StatusCode">StatusCode</a></h4></section></summary><div class="docblock"><p>Returns appropriate status code for error.</p>
|
|||
|
<p>A 500 Internal Server Error is used by default. If <a href="trait.ResponseError.html#method.error_response">error_response</a> is
|
|||
|
also implemented and does not call <code>self.status_code()</code>, then this will not be used.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.error_response" class="method"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#39-49">source</a><h4 class="code-header">fn <a href="#method.error_response" class="fn">error_response</a>(&self) -> <a class="struct" href="../struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</a><<a class="struct" href="../body/struct.BoxBody.html" title="struct actix_web::body::BoxBody">BoxBody</a>></h4></section></summary><div class="docblock"><p>Creates full response for error.</p>
|
|||
|
<p>By default, the generated response uses a 500 Internal Server Error status code, a
|
|||
|
<code>Content-Type</code> of <code>text/plain</code>, and the body is set to <code>Self</code>’s <code>Display</code> impl.</p>
|
|||
|
</div></details></div><h2 id="implementations" class="section-header">Implementations<a href="#implementations" class="anchor">§</a></h2><div id="implementations-list"><details class="toggle implementors-toggle" open><summary><section id="impl-dyn+ResponseError" class="impl"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#54">source</a><a href="#impl-dyn+ResponseError" class="anchor">§</a><h3 class="code-header">impl dyn <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> + 'static</h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.downcast_ref" class="method"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#54">source</a><h4 class="code-header">pub fn <a href="#method.downcast_ref" class="fn">downcast_ref</a><T: <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> + 'static>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&T</a>></h4></section></summary><div class="docblock"><p>Downcasts generic body to a specific type.</p>
|
|||
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.downcast_mut" class="method"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#54">source</a><h4 class="code-header">pub fn <a href="#method.downcast_mut" class="fn">downcast_mut</a><T: <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> + 'static>(&mut self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut T</a>></h4></section></summary><div class="docblock"><p>Downcasts a generic body to a mutable specific type.</p>
|
|||
|
</div></details></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-ResponseError-for-HandshakeError" class="impl"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#137-141">source</a><a href="#impl-ResponseError-for-HandshakeError" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for <a class="enum" href="../../actix_http/ws/enum.HandshakeError.html" title="enum actix_http::ws::HandshakeError">HandshakeError</a></h3></section></summary><div class="impl-items"><section id="method.error_response-1" class="method trait-impl"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#138-140">source</a><a href="#method.error_response-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.error_response" class="fn">error_response</a>(&self) -> <a class="struct" href="../struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</a><<a class="struct" href="../body/struct.BoxBody.html" title="struct actix_web::body::BoxBody">BoxBody</a>></h4></section></div></details><section id="impl-ResponseError-for-ProtocolError" class="impl"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#129">source</a><a href="#impl-ResponseError-for-ProtocolError" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for <a class="enum" href="../../actix_http/ws/enum.ProtocolError.html" title="enum actix_http::ws::ProtocolError">ProtocolError</a></h3></section><details class="toggle implementors-toggle"><summary><section id="impl-ResponseError-for-Infallible" class="impl"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#58-65">source</a><a href="#impl-ResponseError-for-Infallible" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h3></section></summary><div class="impl-items"><section id="method.status_code-1" class="method trait-impl"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#59-61">source</a><a href="#method.status_code-1" class="anchor">§</a><h4 class="code-header">fn <a href="#method.status_code" class="fn">status_code</a>(&self) -> <a class="struct" href="../http/struct.StatusCode.html" title="struct actix_web::http::StatusCode">StatusCode</a></h4></section><section id="method.error_response-2" class="method trait-impl"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#62-64">source</a><a href="#method.error_response-2" class="anchor">§</a><h4 class="code-header">fn <a href="#method.error_response" class="fn">error_response</a>(&self) -> <a class="struct" href="../struct.HttpResponse.html" title="struct actix_web::HttpResponse">HttpResponse</a><<a class="struct" href="../body/struct.BoxBody.html" title="struct actix_web::body::BoxBody">BoxBody</a>></h4></section></div></details><section id="impl-ResponseError-for-Box%3Cdyn+Error%3E" class="impl"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#56">source</a><a href="#impl-ResponseError-for-Box%3Cdyn+Error%3E" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/error/trait.
|
|||
|
</div><section id="impl-ResponseError-for-PayloadError" class="impl"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#120-127">source</a><a href="#impl-ResponseError-for-PayloadError" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for <a class="enum" href="enum.PayloadError.html" title="enum actix_web::error::PayloadError">PayloadError</a></h3></section><section id="impl-ResponseError-for-QueryPayloadError" class="impl"><a class="src rightside" href="../../src/actix_web/error/mod.rs.html#188-192">source</a><a href="#impl-ResponseError-for-QueryPayloadError" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for <a class="enum" href="enum.QueryPayloadError.html" title="enum actix_web::error::QueryPayloadError">QueryPayloadError</a></h3></section><section id="impl-ResponseError-for-ReadlinesError" class="impl"><a class="src rightside" href="../../src/actix_web/error/mod.rs.html#215-222">source</a><a href="#impl-ResponseError-for-ReadlinesError" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for <a class="enum" href="enum.ReadlinesError.html" title="enum actix_web::error::ReadlinesError">ReadlinesError</a></h3></section><section id="impl-ResponseError-for-UrlGenerationError" class="impl"><a class="src rightside" href="../../src/actix_web/error/mod.rs.html#55">source</a><a href="#impl-ResponseError-for-UrlGenerationError" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for <a class="enum" href="enum.UrlGenerationError.html" title="enum actix_web::error::UrlGenerationError">UrlGenerationError</a></h3></section><section id="impl-ResponseError-for-UrlencodedError" class="impl"><a class="src rightside" href="../../src/actix_web/error/mod.rs.html#98-107">source</a><a href="#impl-ResponseError-for-UrlencodedError" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for <a class="enum" href="enum.UrlencodedError.html" title="enum actix_web::error::UrlencodedError">UrlencodedError</a></h3></section><section id="impl-ResponseError-for-InvalidHeaderValue" class="impl"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#108-112">source</a><a href="#impl-ResponseError-for-InvalidHeaderValue" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for <a class="struct" href="../http/header/struct.InvalidHeaderValue.html" title="struct actix_web::http::header::InvalidHeaderValue">InvalidHeaderValue</a></h3></section><section id="impl-ResponseError-for-Error-5" class="impl"><a class="src rightside" href="../../src/actix_web/error/response_error.rs.html#98-106">source</a><a href="#impl-ResponseError-for-Error-5" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for actix_web::http::<a class="struct" href="../http/struct.Error.html" title="struct actix_web::http::Error">Error</a></h3></section><section id="impl-ResponseError-for-BlockingError" class="impl"><a class="src rightside" href="../../src/actix_web/error/mod.rs.html#36">source</a><a href="#impl-ResponseError-for-BlockingError" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.ResponseError.html" title="trait actix_web::error::ResponseError">ResponseError</a> for <a class="struct" href="struct.BlockingError.html" title="struct actix_web::error::BlockingError">BlockingError</a></h3></section><section id="impl-ResponseError-
|
|||
|
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>,</div></h3></section></div><script src="../../trait.impl/actix_web/error/response_error/trait.ResponseError.js" data-ignore-extern-crates="serde,serde_json,actix_http,std,alloc,http,core,openssl,serde_urlencoded" async></script></section></div></main></body></html>
|