1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-23 16:21:06 +01:00
actix-web/actix_http/trait.HttpMessage.html
2024-05-27 01:16:31 +00:00

31 lines
18 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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_http - 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_http" 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_http/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_http/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_http/index.html">actix_http</a><span class="version">3.7.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">&amp;&#x27;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_http</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_http</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-104">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</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>(&amp;self) -&gt; &amp;<a class="struct" href="header/map/struct.HeaderMap.html" title="struct actix_http::header::map::HeaderMap">HeaderMap</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.take_payload" class="fn">take_payload</a>(&amp;mut self) -&gt; <a class="enum" href="enum.Payload.html" title="enum actix_http::Payload">Payload</a>&lt;Self::<a class="associatedtype" href="trait.HttpMessage.html#associatedtype.Stream" title="type actix_http::HttpMessage::Stream">Stream</a>&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.extensions" class="fn">extensions</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.Ref.html" title="struct core::cell::Ref">Ref</a>&lt;'_, <a class="struct" href="struct.Extensions.html" title="struct actix_http::Extensions">Extensions</a>&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.extensions_mut" class="fn">extensions_mut</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.RefMut.html" title="struct core::cell::RefMut">RefMut</a>&lt;'_, <a class="struct" href="struct.Extensions.html" title="struct actix_http::Extensions">Extensions</a>&gt;;
// Provided methods
fn <a href="#method.content_type" class="fn">content_type</a>(&amp;self) -&gt; &amp;<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>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&amp;'static Encoding, <a class="enum" href="error/enum.ContentTypeError.html" title="enum actix_http::error::ContentTypeError">ContentTypeError</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.mime_type" class="fn">mime_type</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://docs.rs/mime/0.3.17/mime/struct.Mime.html" title="struct mime::Mime">Mime</a>&gt;, <a class="enum" href="error/enum.ContentTypeError.html" title="enum actix_http::error::ContentTypeError">ContentTypeError</a>&gt; { ... }
<span class="item-spacer"></span> fn <a href="#method.chunked" class="fn">chunked</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<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_http::error::ParseError">ParseError</a>&gt; { ... }
}</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>(&amp;self) -&gt; &amp;<a class="struct" href="header/map/struct.HeaderMap.html" title="struct actix_http::header::map::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>(&amp;mut self) -&gt; <a class="enum" href="enum.Payload.html" title="enum actix_http::Payload">Payload</a>&lt;Self::<a class="associatedtype" href="trait.HttpMessage.html#associatedtype.Stream" title="type actix_http::HttpMessage::Stream">Stream</a>&gt;</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>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.Ref.html" title="struct core::cell::Ref">Ref</a>&lt;'_, <a class="struct" href="struct.Extensions.html" title="struct actix_http::Extensions">Extensions</a>&gt;</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>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.RefMut.html" title="struct core::cell::RefMut">RefMut</a>&lt;'_, <a class="struct" href="struct.Extensions.html" title="struct actix_http::Extensions">Extensions</a>&gt;</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-56">source</a><h4 class="code-header">fn <a href="#method.content_type" class="fn">content_type</a>(&amp;self) -&gt; &amp;<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-75">source</a><h4 class="code-header">fn <a href="#method.encoding" class="fn">encoding</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;&amp;'static Encoding, <a class="enum" href="error/enum.ContentTypeError.html" title="enum actix_http::error::ContentTypeError">ContentTypeError</a>&gt;</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-90">source</a><h4 class="code-header">fn <a href="#method.mime_type" class="fn">mime_type</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://docs.rs/mime/0.3.17/mime/struct.Mime.html" title="struct mime::Mime">Mime</a>&gt;, <a class="enum" href="error/enum.ContentTypeError.html" title="enum actix_http::error::ContentTypeError">ContentTypeError</a>&gt;</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-103">source</a><h4 class="code-header">fn <a href="#method.chunked" class="fn">chunked</a>(&amp;self) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<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_http::error::ParseError">ParseError</a>&gt;</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-130">source</a><a href="#impl-HttpMessage-for-%26mut+T" class="anchor">§</a><h3 class="code-header">impl&lt;'a, T&gt; <a class="trait" href="trait.HttpMessage.html" title="trait actix_http::HttpMessage">HttpMessage</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;'a mut T</a><div class="where">where
T: <a class="trait" href="trait.HttpMessage.html" title="trait actix_http::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-119">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>(&amp;mut self) -&gt; <a class="enum" href="enum.Payload.html" title="enum actix_http::Payload">Payload</a>&lt;Self::<a class="associatedtype" href="trait.HttpMessage.html#associatedtype.Stream" title="type actix_http::HttpMessage::Stream">Stream</a>&gt;</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-124">source</a><a href="#method.extensions" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.extensions" class="fn">extensions</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.Ref.html" title="struct core::cell::Ref">Ref</a>&lt;'_, <a class="struct" href="struct.Extensions.html" title="struct actix_http::Extensions">Extensions</a>&gt;</h4></section></summary><div class="docblock"><p>Requests 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-129">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>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.RefMut.html" title="struct core::cell::RefMut">RefMut</a>&lt;'_, <a class="struct" href="struct.Extensions.html" title="struct actix_http::Extensions">Extensions</a>&gt;</h4></section></summary><div class="docblock"><p>Mutable reference to a the requests 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> = &lt;T as <a class="trait" href="trait.HttpMessage.html" title="trait actix_http::HttpMessage">HttpMessage</a>&gt;::<a class="associatedtype" href="trait.HttpMessage.html#associatedtype.Stream" title="type actix_http::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-114">source</a><a href="#method.headers" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.headers" class="fn">headers</a>(&amp;self) -&gt; &amp;<a class="struct" href="header/map/struct.HeaderMap.html" title="struct actix_http::header::map::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-Request%3CP%3E" class="impl"><a class="src rightside" href="../src/actix_http/requests/request.rs.html#24-45">source</a><a href="#impl-HttpMessage-for-Request%3CP%3E" class="anchor">§</a><h3 class="code-header">impl&lt;P&gt; <a class="trait" href="trait.HttpMessage.html" title="trait actix_http::HttpMessage">HttpMessage</a> for <a class="struct" href="struct.Request.html" title="struct actix_http::Request">Request</a>&lt;P&gt;</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> = P</h4></section></div></details></div><script src="../trait.impl/actix_http/http_message/trait.HttpMessage.js" async></script></section></div></main></body></html>