mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-23 16:21:06 +01:00
31 lines
21 KiB
HTML
31 lines
21 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 that implements general purpose operations on HTTP messages."><title>HttpMessage 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="#">HttpMessage</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.Stream">Stream</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.extensions">extensions</a></li><li><a href="#tymethod.extensions_mut">extensions_mut</a></li><li><a href="#tymethod.headers">headers</a></li><li><a href="#tymethod.take_payload">take_payload</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.chunked">chunked</a></li><li><a href="#method.content_type">content_type</a></li><li><a href="#method.encoding">encoding</a></li><li><a href="#method.mime_type">mime_type</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-HttpMessage-for-%26mut+T">&'a mut T</a></li></ul><h3><a href="#object-safety">Object Safety</a></h3><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="#">HttpMessage</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_http/http_message.rs.html#18">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>−</span>]</button></span></div><pre class="rust item-decl"><code>pub trait HttpMessage: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
|
||
type <a href="#associatedtype.Stream" class="associatedtype">Stream</a>;
|
||
|
||
// Required methods
|
||
fn <a href="#tymethod.headers" class="fn">headers</a>(&self) -> &<a class="struct" href="http/header/struct.HeaderMap.html" title="struct actix_web::http::header::HeaderMap">HeaderMap</a>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.take_payload" class="fn">take_payload</a>(&mut self) -> <a class="enum" href="dev/enum.Payload.html" title="enum actix_web::dev::Payload">Payload</a><Self::<a class="associatedtype" href="trait.HttpMessage.html#associatedtype.Stream" title="type actix_web::HttpMessage::Stream">Stream</a>>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.extensions" class="fn">extensions</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.Ref.html" title="struct core::cell::Ref">Ref</a><'_, <a class="struct" href="dev/struct.Extensions.html" title="struct actix_web::dev::Extensions">Extensions</a>>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.extensions_mut" class="fn">extensions_mut</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.RefMut.html" title="struct core::cell::RefMut">RefMut</a><'_, <a class="struct" href="dev/struct.Extensions.html" title="struct actix_web::dev::Extensions">Extensions</a>>;
|
||
|
||
// Provided methods
|
||
fn <a href="#method.content_type" class="fn">content_type</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.encoding" class="fn">encoding</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&'static Encoding, <a class="enum" href="error/enum.ContentTypeError.html" title="enum actix_web::error::ContentTypeError">ContentTypeError</a>> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.mime_type" class="fn">mime_type</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://docs.rs/mime/0.3.17/mime/struct.Mime.html" title="struct mime::Mime">Mime</a>>, <a class="enum" href="error/enum.ContentTypeError.html" title="enum actix_web::error::ContentTypeError">ContentTypeError</a>> { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.chunked" class="fn">chunked</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, <a class="enum" href="error/enum.ParseError.html" title="enum actix_web::error::ParseError">ParseError</a>> { ... }
|
||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Trait that implements general purpose operations on HTTP messages.</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.Stream" class="method"><a class="src rightside" href="../src/actix_http/http_message.rs.html#20">source</a><h4 class="code-header">type <a href="#associatedtype.Stream" class="associatedtype">Stream</a></h4></section></summary><div class="docblock"><p>Type of message payload stream</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.headers" class="method"><a class="src rightside" href="../src/actix_http/http_message.rs.html#23">source</a><h4 class="code-header">fn <a href="#tymethod.headers" class="fn">headers</a>(&self) -> &<a class="struct" href="http/header/struct.HeaderMap.html" title="struct actix_web::http::header::HeaderMap">HeaderMap</a></h4></section></summary><div class="docblock"><p>Read the message headers.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.take_payload" class="method"><a class="src rightside" href="../src/actix_http/http_message.rs.html#26">source</a><h4 class="code-header">fn <a href="#tymethod.take_payload" class="fn">take_payload</a>(&mut self) -> <a class="enum" href="dev/enum.Payload.html" title="enum actix_web::dev::Payload">Payload</a><Self::<a class="associatedtype" href="trait.HttpMessage.html#associatedtype.Stream" title="type actix_web::HttpMessage::Stream">Stream</a>></h4></section></summary><div class="docblock"><p>Message payload stream</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.extensions" class="method"><a class="src rightside" href="../src/actix_http/http_message.rs.html#29">source</a><h4 class="code-header">fn <a href="#tymethod.extensions" class="fn">extensions</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.Ref.html" title="struct core::cell::Ref">Ref</a><'_, <a class="struct" href="dev/struct.Extensions.html" title="struct actix_web::dev::Extensions">Extensions</a>></h4></section></summary><div class="docblock"><p>Returns a reference to the request-local data/extensions container.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.extensions_mut" class="method"><a class="src rightside" href="../src/actix_http/http_message.rs.html#32">source</a><h4 class="code-header">fn <a href="#tymethod.extensions_mut" class="fn">extensions_mut</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.RefMut.html" title="struct core::cell::RefMut">RefMut</a><'_, <a class="struct" href="dev/struct.Extensions.html" title="struct actix_web::dev::Extensions">Extensions</a>></h4></section></summary><div class="docblock"><p>Returns a mutable reference to the request-local data/extensions container.</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.content_type" class="method"><a class="src rightside" href="../src/actix_http/http_message.rs.html#49">source</a><h4 class="code-header">fn <a href="#method.content_type" class="fn">content_type</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></section></summary><div class="docblock"><p>Read the request content type. If request did not contain a <em>Content-Type</em> header, an empty
|
||
string is returned.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.encoding" class="method"><a class="src rightside" href="../src/actix_http/http_message.rs.html#61">source</a><h4 class="code-header">fn <a href="#method.encoding" class="fn">encoding</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><&'static Encoding, <a class="enum" href="error/enum.ContentTypeError.html" title="enum actix_web::error::ContentTypeError">ContentTypeError</a>></h4></section></summary><div class="docblock"><p>Get content type encoding.</p>
|
||
<p>UTF-8 is used by default, If request charset is not set.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.mime_type" class="method"><a class="src rightside" href="../src/actix_http/http_message.rs.html#78">source</a><h4 class="code-header">fn <a href="#method.mime_type" class="fn">mime_type</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://docs.rs/mime/0.3.17/mime/struct.Mime.html" title="struct mime::Mime">Mime</a>>, <a class="enum" href="error/enum.ContentTypeError.html" title="enum actix_web::error::ContentTypeError">ContentTypeError</a>></h4></section></summary><div class="docblock"><p>Convert the request content type to a known mime type.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.chunked" class="method"><a class="src rightside" href="../src/actix_http/http_message.rs.html#93">source</a><h4 class="code-header">fn <a href="#method.chunked" class="fn">chunked</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, <a class="enum" href="error/enum.ParseError.html" title="enum actix_web::error::ParseError">ParseError</a>></h4></section></summary><div class="docblock"><p>Check if request has chunked transfer encoding.</p>
|
||
</div></details></div><h2 id="object-safety" class="section-header">Object Safety<a href="#object-safety" class="anchor">§</a></h2><div class="object-safety-info">This trait is <b>not</b> <a href="https://doc.rust-lang.org/nightly/reference/items/traits.html#object-safety">object safe</a>.</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-HttpMessage-for-%26mut+T" class="impl"><a class="src rightside" href="../src/actix_http/http_message.rs.html#106-108">source</a><a href="#impl-HttpMessage-for-%26mut+T" class="anchor">§</a><h3 class="code-header">impl<'a, T> <a class="trait" href="trait.HttpMessage.html" title="trait actix_web::HttpMessage">HttpMessage</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut T</a><div class="where">where
|
||
T: <a class="trait" href="trait.HttpMessage.html" title="trait actix_web::HttpMessage">HttpMessage</a>,</div></h3></section></summary><div class="impl-items"><details class="toggle method-toggle" open><summary><section id="method.take_payload" class="method trait-impl"><a class="src rightside" href="../src/actix_http/http_message.rs.html#117">source</a><a href="#method.take_payload" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.take_payload" class="fn">take_payload</a>(&mut self) -> <a class="enum" href="dev/enum.Payload.html" title="enum actix_web::dev::Payload">Payload</a><<<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'a mut T</a> as <a class="trait" href="trait.HttpMessage.html" title="trait actix_web::HttpMessage">HttpMessage</a>>::<a class="associatedtype" href="trait.HttpMessage.html#associatedtype.Stream" title="type actix_web::HttpMessage::Stream">Stream</a>></h4></section></summary><div class="docblock"><p>Message payload stream</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.extensions" class="method trait-impl"><a class="src rightside" href="../src/actix_http/http_message.rs.html#122">source</a><a href="#method.extensions" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.extensions" class="fn">extensions</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.Ref.html" title="struct core::cell::Ref">Ref</a><'_, <a class="struct" href="dev/struct.Extensions.html" title="struct actix_web::dev::Extensions">Extensions</a>></h4></section></summary><div class="docblock"><p>Request’s extensions container</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.extensions_mut" class="method trait-impl"><a class="src rightside" href="../src/actix_http/http_message.rs.html#127">source</a><a href="#method.extensions_mut" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.extensions_mut" class="fn">extensions_mut</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.RefMut.html" title="struct core::cell::RefMut">RefMut</a><'_, <a class="struct" href="dev/struct.Extensions.html" title="struct actix_web::dev::Extensions">Extensions</a>></h4></section></summary><div class="docblock"><p>Mutable reference to a the request’s extensions container</p>
|
||
</div></details><section id="associatedtype.Stream-1" class="associatedtype trait-impl"><a href="#associatedtype.Stream-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Stream" class="associatedtype">Stream</a> = <T as <a class="trait" href="trait.HttpMessage.html" title="trait actix_web::HttpMessage">HttpMessage</a>>::<a class="associatedtype" href="trait.HttpMessage.html#associatedtype.Stream" title="type actix_web::HttpMessage::Stream">Stream</a></h4></section><section id="method.headers" class="method trait-impl"><a class="src rightside" href="../src/actix_http/http_message.rs.html#112">source</a><a href="#method.headers" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.headers" class="fn">headers</a>(&self) -> &<a class="struct" href="http/header/struct.HeaderMap.html" title="struct actix_web::http::header::HeaderMap">HeaderMap</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-HttpMessage-for-ServiceRequest" class="impl"><a class="src rightside" href="../src/actix_web/service.rs.html#340-362">source</a><a href="#impl-HttpMessage-for-ServiceRequest" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.HttpMessage.html" title="trait actix_web::HttpMessage">HttpMessage</a> for <a class="struct" href="dev/struct.ServiceRequest.html" title="struct actix_web::dev::ServiceRequest">ServiceRequest</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Stream-2" class="associatedtype trait-impl"><a href="#associatedtype.Stream-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Stream" class="associatedtype">Stream</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/core/pin/struct.Pin.html" title="struct core::pin::Pin">Pin</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn Stream<Item = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="struct" href="web/struct.Bytes.html" title="struct actix_web::web::Bytes">Bytes</a>, <a class="enum" href="error/enum.PayloadError.html" title="enum actix_web::error::PayloadError">PayloadError</a>>>>></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HttpMessage-for-HttpRequest" class="impl"><a class="src rightside" href="../src/actix_web/request.rs.html#349-371">source</a><a href="#impl-HttpMessage-for-HttpRequest" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.HttpMessage.html" title="trait actix_web::HttpMessage">HttpMessage</a> for <a class="struct" href="struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a></h3></section></summary><div class="impl-items"><section id="associatedtype.Stream-3" class="associatedtype trait-impl"><a href="#associatedtype.Stream-3" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Stream" class="associatedtype">Stream</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-HttpMessage-for-Request%3CP%3E" class="impl"><a class="src rightside" href="../src/actix_http/requests/request.rs.html#24">source</a><a href="#impl-HttpMessage-for-Request%3CP%3E" class="anchor">§</a><h3 class="code-header">impl<P> <a class="trait" href="trait.HttpMessage.html" title="trait actix_web::HttpMessage">HttpMessage</a> for <a class="struct" href="../actix_http/requests/request/struct.Request.html" title="struct actix_http::requests::request::Request">Request</a><P></h3></section></summary><div class="impl-items"><section id="associatedtype.Stream-4" class="associatedtype trait-impl"><a href="#associatedtype.Stream-4" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.Stream" class="associatedtype">Stream</a> = P</h4></section></div></details></div><script src="../trait.impl/actix_http/http_message/trait.HttpMessage.js" data-ignore-extern-crates="actix_http" async></script></section></div></main></body></html> |