mirror of
https://github.com/actix/actix-website
synced 2024-11-25 01:02:58 +01:00
202 lines
89 KiB
HTML
202 lines
89 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="API documentation for the Rust `FromRequest` trait in crate `actix_web`."><meta name="keywords" content="rust, rustlang, rust-lang, FromRequest"><title>actix_web::FromRequest - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><p class='location'>Trait FromRequest</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#associated-types">Associated Types</a><div class="sidebar-links"><a href="#associatedtype.Config">Config</a><a href="#associatedtype.Result">Result</a></div><a class="sidebar-title" href="#required-methods">Required Methods</a><div class="sidebar-links"><a href="#tymethod.from_request">from_request</a></div><a class="sidebar-title" href="#provided-methods">Provided Methods</a><div class="sidebar-links"><a href="#method.extract">extract</a></div><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-FromRequest%3CS%3E">Bytes</a><a href="#impl-FromRequest%3CS%3E">String</a><a href="#impl-FromRequest%3CS%3E">Option<T></a><a href="#impl-FromRequest%3CS%3E">Result<T, Error></a><a href="#impl-FromRequest%3CS%3E">(A,)</a><a href="#impl-FromRequest%3CS%3E">(A, B)</a><a href="#impl-FromRequest%3CS%3E">(A, B, C)</a><a href="#impl-FromRequest%3CS%3E">(A, B, C, D)</a><a href="#impl-FromRequest%3CS%3E">(A, B, C, D, E)</a><a href="#impl-FromRequest%3CS%3E">(A, B, C, D, E, F)</a><a href="#impl-FromRequest%3CS%3E">(A, B, C, D, E, F, G)</a><a href="#impl-FromRequest%3CS%3E">(A, B, C, D, E, F, G, H)</a><a href="#impl-FromRequest%3CS%3E">(A, B, C, D, E, F, G, H, I)</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class='location'><a href='index.html'>actix_web</a></p><script>window.sidebarCurrent = {name: 'FromRequest', ty: 'trait', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form js-only"><div class="search-container"><input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='in-band'>Trait <a href='index.html'>actix_web</a>::<wbr><a class="trait" href=''>FromRequest</a></span><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>−</span>]</a></span><a class='srclink' href='../src/actix_web/handler.rs.html#42-58' title='goto source code'>[src]</a></span></h1><div class="docblock type-decl"><pre class='rust trait'>pub trait FromRequest<S>: <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.Config' class="type">Config</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a>;
|
|||
|
type <a href='#associatedtype.Result' class="type">Result</a>: <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="../actix_web/dev/struct.AsyncResult.html" title="struct actix_web::dev::AsyncResult">AsyncResult</a><Self>>;
|
|||
|
fn <a href='#tymethod.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a>;
|
|||
|
|
|||
|
fn <a href='#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a> { ... }
|
|||
|
}</pre></div><div class='docblock'><p>Trait implemented by types that can be extracted from request.</p>
|
|||
|
<p>Types that implement this trait can be used with <code>Route::with()</code> method.</p>
|
|||
|
</div>
|
|||
|
<h2 id='associated-types' class='small-section-header'>
|
|||
|
Associated Types<a href='#associated-types' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<div class='methods'>
|
|||
|
<h3 id='associatedtype.Config' class='method'><span id='Config.t' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a></code></span></h3><div class='docblock'><p>Configuration for conversion process</p>
|
|||
|
</div><h3 id='associatedtype.Result' class='method'><span id='Result.t' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a>: <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="../actix_web/dev/struct.AsyncResult.html" title="struct actix_web::dev::AsyncResult">AsyncResult</a><Self>></code></span></h3><div class='docblock'><p>Future that resolves to a Self</p>
|
|||
|
</div></div>
|
|||
|
<h2 id='required-methods' class='small-section-header'>
|
|||
|
Required Methods<a href='#required-methods' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<div class='methods'>
|
|||
|
<h3 id='tymethod.from_request' class='method'><span id='from_request.v' class='invisible'><code>fn <a href='#tymethod.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></h3><div class='docblock'><p>Convert request to a Self</p>
|
|||
|
</div></div>
|
|||
|
<h2 id='provided-methods' class='small-section-header'>
|
|||
|
Provided Methods<a href='#provided-methods' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<div class='methods'>
|
|||
|
<h3 id='method.extract' class='method'><span id='extract.v' class='invisible'><code>fn <a href='#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></h3><div class='docblock'><p>Convert request to a Self</p>
|
|||
|
<p>This method uses default extractor configuration</p>
|
|||
|
</div></div>
|
|||
|
<h2 id='foreign-impls' class='small-section-header'>
|
|||
|
Implementations on Foreign Types<a href='#foreign-impls' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<h3 id='impl-FromRequest%3CS%3E' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<S: 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="struct" href="https://docs.rs/bytes/0.4.9/bytes/bytes/struct.Bytes.html" title="struct bytes::bytes::Bytes">Bytes</a></code><a href='#impl-FromRequest%3CS%3E' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#389-400' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>Request payload extractor.</p>
|
|||
|
<p>Loads request's payload and construct Bytes instance.</p>
|
|||
|
<p><a href="dev/struct.PayloadConfig.html"><strong>PayloadConfig</strong></a> allows to configure
|
|||
|
extraction process.</p>
|
|||
|
<h2 id="example" class="section-header"><a href="#example">Example</a></h2>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">bytes</span>;
|
|||
|
<span class="kw">use</span> <span class="ident">actix_web</span>::{<span class="ident">http</span>, <span class="ident">App</span>, <span class="prelude-ty">Result</span>};
|
|||
|
|
|||
|
<span class="doccomment">/// extract text data from request</span>
|
|||
|
<span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">body</span>: <span class="ident">bytes</span>::<span class="ident">Bytes</span>) <span class="op">-></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
|||
|
<span class="prelude-val">Ok</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">"Body {:?}!"</span>, <span class="ident">body</span>))
|
|||
|
}
|
|||
|
|
|||
|
<span class="kw">fn</span> <span class="ident">main</span>() {
|
|||
|
<span class="kw">let</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>()
|
|||
|
.<span class="ident">resource</span>(<span class="string">"/index.html"</span>, <span class="op">|</span><span class="ident">r</span><span class="op">|</span> <span class="ident">r</span>.<span class="ident">method</span>(<span class="ident">http</span>::<span class="ident">Method</span>::<span class="ident">GET</span>).<span class="ident">with</span>(<span class="ident">index</span>));
|
|||
|
}</pre>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-1' class="type"><span id='Config.t-1' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = <a class="struct" href="../actix_web/dev/struct.PayloadConfig.html" title="struct actix_web::dev::PayloadConfig">PayloadConfig</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-1' class="type"><span id='Result.t-1' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <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="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = Self, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>>, <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>></code></span></h4>
|
|||
|
<h4 id='method.from_request' class="method"><span id='from_request.v-1' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#394-399' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-1' class="method"><span id='extract.v-1' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-1' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<S: 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code><a href='#impl-FromRequest%3CS%3E-1' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#429-459' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>Extract text information from the request's body.</p>
|
|||
|
<p>Text extractor automatically decode body according to the request's charset.</p>
|
|||
|
<p><a href="dev/struct.PayloadConfig.html"><strong>PayloadConfig</strong></a> allows to configure
|
|||
|
extraction process.</p>
|
|||
|
<h2 id="example-1" class="section-header"><a href="#example-1">Example</a></h2>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">use</span> <span class="ident">actix_web</span>::{<span class="ident">http</span>, <span class="ident">App</span>, <span class="prelude-ty">Result</span>};
|
|||
|
|
|||
|
<span class="doccomment">/// extract text data from request</span>
|
|||
|
<span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">body</span>: <span class="ident">String</span>) <span class="op">-></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
|||
|
<span class="prelude-val">Ok</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">"Body {}!"</span>, <span class="ident">body</span>))
|
|||
|
}
|
|||
|
|
|||
|
<span class="kw">fn</span> <span class="ident">main</span>() {
|
|||
|
<span class="kw">let</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>().<span class="ident">resource</span>(<span class="string">"/index.html"</span>, <span class="op">|</span><span class="ident">r</span><span class="op">|</span> {
|
|||
|
<span class="ident">r</span>.<span class="ident">method</span>(<span class="ident">http</span>::<span class="ident">Method</span>::<span class="ident">GET</span>)
|
|||
|
.<span class="ident">with_config</span>(<span class="ident">index</span>, <span class="op">|</span><span class="ident">cfg</span><span class="op">|</span> { <span class="comment">// <- register handler with extractor params</span>
|
|||
|
<span class="ident">cfg</span>.<span class="ident">limit</span>(<span class="number">4096</span>); <span class="comment">// <- limit size of the payload</span>
|
|||
|
})
|
|||
|
});
|
|||
|
}</pre>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-2' class="type"><span id='Config.t-2' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = <a class="struct" href="../actix_web/dev/struct.PayloadConfig.html" title="struct actix_web::dev::PayloadConfig">PayloadConfig</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-2' class="type"><span id='Result.t-2' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <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="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>>, <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>></code></span></h4>
|
|||
|
<h4 id='method.from_request-1' class="method"><span id='from_request.v-2' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#434-458' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-2' class="method"><span id='extract.v-2' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-2' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T: 'static, S: 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S>, </span></code><a href='#impl-FromRequest%3CS%3E-2' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#507-521' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>Optionally extract a field from the request</p>
|
|||
|
<p>If the FromRequest for T fails, return None rather than returning an error response</p>
|
|||
|
<h2 id="example-2" class="section-header"><a href="#example-2">Example</a></h2>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">rand</span>;
|
|||
|
<span class="attribute">#[<span class="ident">macro_use</span>]</span> <span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">serde_derive</span>;
|
|||
|
<span class="kw">use</span> <span class="ident">actix_web</span>::{<span class="ident">http</span>, <span class="ident">App</span>, <span class="prelude-ty">Result</span>, <span class="ident">HttpRequest</span>, <span class="ident">Error</span>, <span class="ident">FromRequest</span>};
|
|||
|
<span class="kw">use</span> <span class="ident">actix_web</span>::<span class="ident">error</span>::<span class="ident">ErrorBadRequest</span>;
|
|||
|
|
|||
|
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Deserialize</span>)]</span>
|
|||
|
<span class="kw">struct</span> <span class="ident">Thing</span> { <span class="ident">name</span>: <span class="ident">String</span> }
|
|||
|
|
|||
|
<span class="kw">impl</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> <span class="ident">FromRequest</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> <span class="kw">for</span> <span class="ident">Thing</span> {
|
|||
|
<span class="kw">type</span> <span class="ident">Config</span> <span class="op">=</span> ();
|
|||
|
<span class="kw">type</span> <span class="prelude-ty">Result</span> <span class="op">=</span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">Thing</span>, <span class="ident">Error</span><span class="op">></span>;
|
|||
|
|
|||
|
<span class="attribute">#[<span class="ident">inline</span>]</span>
|
|||
|
<span class="kw">fn</span> <span class="ident">from_request</span>(<span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">HttpRequest</span><span class="op"><</span><span class="ident">S</span><span class="op">></span>, <span class="ident">_cfg</span>: <span class="kw-2">&</span><span class="self">Self</span>::<span class="ident">Config</span>) <span class="op">-></span> <span class="self">Self</span>::<span class="prelude-ty">Result</span> {
|
|||
|
<span class="kw">if</span> <span class="ident">rand</span>::<span class="ident">random</span>() {
|
|||
|
<span class="prelude-val">Ok</span>(<span class="ident">Thing</span> { <span class="ident">name</span>: <span class="string">"thingy"</span>.<span class="ident">into</span>() })
|
|||
|
} <span class="kw">else</span> {
|
|||
|
<span class="prelude-val">Err</span>(<span class="ident">ErrorBadRequest</span>(<span class="string">"no luck"</span>))
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
<span class="doccomment">/// extract text data from request</span>
|
|||
|
<span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">supplied_thing</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Thing</span><span class="op">></span>) <span class="op">-></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
|||
|
<span class="kw">match</span> <span class="ident">supplied_thing</span> {
|
|||
|
<span class="comment">// Puns not intended</span>
|
|||
|
<span class="prelude-val">Some</span>(<span class="ident">thing</span>) <span class="op">=></span> <span class="prelude-val">Ok</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">"Got something: {:?}"</span>, <span class="ident">thing</span>)),
|
|||
|
<span class="prelude-val">None</span> <span class="op">=></span> <span class="prelude-val">Ok</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">"No thing!"</span>))
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
<span class="kw">fn</span> <span class="ident">main</span>() {
|
|||
|
<span class="kw">let</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>().<span class="ident">resource</span>(<span class="string">"/users/:first"</span>, <span class="op">|</span><span class="ident">r</span><span class="op">|</span> {
|
|||
|
<span class="ident">r</span>.<span class="ident">method</span>(<span class="ident">http</span>::<span class="ident">Method</span>::<span class="ident">POST</span>).<span class="ident">with</span>(<span class="ident">index</span>)
|
|||
|
});
|
|||
|
}</pre>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-3' class="type"><span id='Config.t-3' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = T::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-3' class="type"><span id='Result.t-3' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><T>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>></code></span></h4>
|
|||
|
<h4 id='method.from_request-2' class="method"><span id='from_request.v-3' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#515-520' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-3' class="method"><span id='extract.v-3' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-3' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<T: 'static, S: 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>> <span class="where fmt-newline">where<br> T: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S>, </span></code><a href='#impl-FromRequest%3CS%3E-3' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#568-579' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>Optionally extract a field from the request or extract the Error if unsuccessful</p>
|
|||
|
<p>If the FromRequest for T fails, inject Err into handler rather than returning an error response</p>
|
|||
|
<h2 id="example-3" class="section-header"><a href="#example-3">Example</a></h2>
|
|||
|
<pre class="rust rust-example-rendered">
|
|||
|
<span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">rand</span>;
|
|||
|
<span class="attribute">#[<span class="ident">macro_use</span>]</span> <span class="kw">extern</span> <span class="kw">crate</span> <span class="ident">serde_derive</span>;
|
|||
|
<span class="kw">use</span> <span class="ident">actix_web</span>::{<span class="ident">http</span>, <span class="ident">App</span>, <span class="prelude-ty">Result</span>, <span class="ident">HttpRequest</span>, <span class="ident">Error</span>, <span class="ident">FromRequest</span>};
|
|||
|
<span class="kw">use</span> <span class="ident">actix_web</span>::<span class="ident">error</span>::<span class="ident">ErrorBadRequest</span>;
|
|||
|
|
|||
|
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Deserialize</span>)]</span>
|
|||
|
<span class="kw">struct</span> <span class="ident">Thing</span> { <span class="ident">name</span>: <span class="ident">String</span> }
|
|||
|
|
|||
|
<span class="kw">impl</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> <span class="ident">FromRequest</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> <span class="kw">for</span> <span class="ident">Thing</span> {
|
|||
|
<span class="kw">type</span> <span class="ident">Config</span> <span class="op">=</span> ();
|
|||
|
<span class="kw">type</span> <span class="prelude-ty">Result</span> <span class="op">=</span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">Thing</span>, <span class="ident">Error</span><span class="op">></span>;
|
|||
|
|
|||
|
<span class="attribute">#[<span class="ident">inline</span>]</span>
|
|||
|
<span class="kw">fn</span> <span class="ident">from_request</span>(<span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">HttpRequest</span><span class="op"><</span><span class="ident">S</span><span class="op">></span>, <span class="ident">_cfg</span>: <span class="kw-2">&</span><span class="self">Self</span>::<span class="ident">Config</span>) <span class="op">-></span> <span class="self">Self</span>::<span class="prelude-ty">Result</span> {
|
|||
|
<span class="kw">if</span> <span class="ident">rand</span>::<span class="ident">random</span>() {
|
|||
|
<span class="prelude-val">Ok</span>(<span class="ident">Thing</span> { <span class="ident">name</span>: <span class="string">"thingy"</span>.<span class="ident">into</span>() })
|
|||
|
} <span class="kw">else</span> {
|
|||
|
<span class="prelude-val">Err</span>(<span class="ident">ErrorBadRequest</span>(<span class="string">"no luck"</span>))
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
<span class="doccomment">/// extract text data from request</span>
|
|||
|
<span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">supplied_thing</span>: <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">Thing</span><span class="op">></span>) <span class="op">-></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
|||
|
<span class="kw">match</span> <span class="ident">supplied_thing</span> {
|
|||
|
<span class="prelude-val">Ok</span>(<span class="ident">thing</span>) <span class="op">=></span> <span class="prelude-val">Ok</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">"Got thing: {:?}"</span>, <span class="ident">thing</span>)),
|
|||
|
<span class="prelude-val">Err</span>(<span class="ident">e</span>) <span class="op">=></span> <span class="prelude-val">Ok</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">"Error extracting thing: {}"</span>, <span class="ident">e</span>))
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
<span class="kw">fn</span> <span class="ident">main</span>() {
|
|||
|
<span class="kw">let</span> <span class="ident">app</span> <span class="op">=</span> <span class="ident">App</span>::<span class="ident">new</span>().<span class="ident">resource</span>(<span class="string">"/users/:first"</span>, <span class="op">|</span><span class="ident">r</span><span class="op">|</span> {
|
|||
|
<span class="ident">r</span>.<span class="ident">method</span>(<span class="ident">http</span>::<span class="ident">Method</span>::<span class="ident">POST</span>).<span class="ident">with</span>(<span class="ident">index</span>)
|
|||
|
});
|
|||
|
}</pre>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-4' class="type"><span id='Config.t-4' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = T::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-4' class="type"><span id='Result.t-4' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>></code></span></h4>
|
|||
|
<h4 id='method.from_request-3' class="method"><span id='from_request.v-4' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#576-578' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-4' class="method"><span id='extract.v-4' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-4' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<S, A: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">,)</a> <span class="where fmt-newline">where<br> S: 'static, </span></code><a href='#impl-FromRequest%3CS%3E-4' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#634-648' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>FromRequest implementation for tuple</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-5' class="type"><span id='Config.t-5' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">,)</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-5' class="type"><span id='Result.t-5' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">,)</a>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>></code></span></h4>
|
|||
|
<h4 id='method.from_request-4' class="method"><span id='from_request.v-5' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#641-647' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-5' class="method"><span id='extract.v-5' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-5' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<S, A: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, B: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a> <span class="where fmt-newline">where<br> S: 'static, </span></code><a href='#impl-FromRequest%3CS%3E-5' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#634-648' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>FromRequest implementation for tuple</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-6' class="type"><span id='Config.t-6' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, B::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-6' class="type"><span id='Result.t-6' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>></code></span></h4>
|
|||
|
<h4 id='method.from_request-5' class="method"><span id='from_request.v-6' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#641-647' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-6' class="method"><span id='extract.v-6' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-6' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<S, A: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, B: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, C: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a> <span class="where fmt-newline">where<br> S: 'static, </span></code><a href='#impl-FromRequest%3CS%3E-6' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#634-648' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>FromRequest implementation for tuple</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-7' class="type"><span id='Config.t-7' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, B::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, C::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-7' class="type"><span id='Result.t-7' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>></code></span></h4>
|
|||
|
<h4 id='method.from_request-6' class="method"><span id='from_request.v-7' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#641-647' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-7' class="method"><span id='extract.v-7' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-7' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<S, A: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, B: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, C: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, D: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a> <span class="where fmt-newline">where<br> S: 'static, </span></code><a href='#impl-FromRequest%3CS%3E-7' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#634-648' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>FromRequest implementation for tuple</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-8' class="type"><span id='Config.t-8' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, B::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, C::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, D::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-8' class="type"><span id='Result.t-8' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>></code></span></h4>
|
|||
|
<h4 id='method.from_request-7' class="method"><span id='from_request.v-8' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#641-647' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-8' class="method"><span id='extract.v-8' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-8' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<S, A: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, B: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, C: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, D: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, E: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D, E<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a> <span class="where fmt-newline">where<br> S: 'static, </span></code><a href='#impl-FromRequest%3CS%3E-8' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#634-648' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>FromRequest implementation for tuple</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-9' class="type"><span id='Config.t-9' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, B::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, C::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, D::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, E::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-9' class="type"><span id='Result.t-9' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D, E<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>></code></span></h4>
|
|||
|
<h4 id='method.from_request-8' class="method"><span id='from_request.v-9' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#641-647' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-9' class="method"><span id='extract.v-9' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-9' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<S, A: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, B: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, C: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, D: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, E: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, F: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D, E, F<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a> <span class="where fmt-newline">where<br> S: 'static, </span></code><a href='#impl-FromRequest%3CS%3E-9' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#634-648' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>FromRequest implementation for tuple</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-10' class="type"><span id='Config.t-10' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, B::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, C::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, D::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, E::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, F::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-10' class="type"><span id='Result.t-10' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D, E, F<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>></code></span></h4>
|
|||
|
<h4 id='method.from_request-9' class="method"><span id='from_request.v-10' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#641-647' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-10' class="method"><span id='extract.v-10' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-10' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<S, A: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, B: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, C: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, D: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, E: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, F: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, G: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D, E, F, G<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a> <span class="where fmt-newline">where<br> S: 'static, </span></code><a href='#impl-FromRequest%3CS%3E-10' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#634-648' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>FromRequest implementation for tuple</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-11' class="type"><span id='Config.t-11' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, B::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, C::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, D::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, E::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, F::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, G::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-11' class="type"><span id='Result.t-11' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D, E, F, G<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>></code></span></h4>
|
|||
|
<h4 id='method.from_request-10' class="method"><span id='from_request.v-11' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#641-647' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-11' class="method"><span id='extract.v-11' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-11' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<S, A: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, B: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, C: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, D: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, E: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, F: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, G: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, H: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D, E, F, G, H<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a> <span class="where fmt-newline">where<br> S: 'static, </span></code><a href='#impl-FromRequest%3CS%3E-11' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#634-648' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>FromRequest implementation for tuple</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-12' class="type"><span id='Config.t-12' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, B::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, C::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, D::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, E::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, F::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, G::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, H::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-12' class="type"><span id='Result.t-12' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D, E, F, G, H<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>></code></span></h4>
|
|||
|
<h4 id='method.from_request-11' class="method"><span id='from_request.v-12' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#641-647' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-12' class="method"><span id='extract.v-12' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span><h3 id='impl-FromRequest%3CS%3E-12' class='impl'><span class='in-band'><table class='table-display'><tbody><tr><td><code>impl<S, A: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, B: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, C: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, D: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, E: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, F: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, G: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, H: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static, I: <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> + 'static> <a class="trait" href="../actix_web/trait.FromRequest.html" title="trait actix_web::FromRequest">FromRequest</a><S> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D, E, F, G, H, I<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a> <span class="where fmt-newline">where<br> S: 'static, </span></code><a href='#impl-FromRequest%3CS%3E-12' class='anchor'></a></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#634-648' title='goto source code'>[src]</a></span></td></tr></tbody></table></h3><div class='docblock'><p>FromRequest implementation for tuple</p>
|
|||
|
</div><span class='docblock autohide'><div class='impl-items'><h4 id='associatedtype.Config-13' class="type"><span id='Config.t-13' class='invisible'><code>type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, B::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, C::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, D::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, E::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, F::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, G::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, H::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>, I::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code></span></h4>
|
|||
|
<h4 id='associatedtype.Result-13' class="type"><span id='Result.t-13' class='invisible'><code>type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>A, B, C, D, E, F, G, H, I<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a>, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>></code></span></h4>
|
|||
|
<h4 id='method.from_request-12' class="method"><span id='from_request.v-13' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='#method.from_request' class='fnname'>from_request</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>, cfg: &Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Config" title="type actix_web::FromRequest::Config">Config</a>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/extractor.rs.html#641-647' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4><h4 id='method.extract-13' class="method"><span id='extract.v-13' class='invisible'><table class='table-display'><tbody><tr><td><code>fn <a href='../actix_web/trait.FromRequest.html#method.extract' class='fnname'>extract</a>(req: &<a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S>) -> Self::<a class="type" href="../actix_web/trait.FromRequest.html#associatedtype.Result" title="type actix_web::FromRequest::Result">Result</a></code></span></td><td><span class='out-of-band'><div class='ghost'></div><a class='srclink' href='../src/actix_web/handler.rs.html#55-57' title='goto source code'>[src]</a></td></tr></tbody></table></span></h4></div></span>
|
|||
|
<h2 id='implementors' class='small-section-header'>
|
|||
|
Implementors<a href='#implementors' class='anchor'></a>
|
|||
|
</h2>
|
|||
|
<ul class='item-list' id='implementors-list'>
|
|||
|
<li><table class='table-display'><tbody><tr><td><code>impl<T, S> FromRequest<S> for <a class="struct" href="../actix_web/struct.Path.html" title="struct actix_web::Path">Path</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://docs.rs/serde/1.0.70/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>, </span><span class="where fmt-newline"> type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Result' class="type">Result</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>;</span></code><td><div class='out-of-band'><a class='srclink' href='../src/actix_web/extractor.rs.html#104-118' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
|
|||
|
<li><table class='table-display'><tbody><tr><td><code>impl<T, S> FromRequest<S> for <a class="struct" href="../actix_web/struct.Query.html" title="struct actix_web::Query">Query</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://docs.rs/serde/1.0.70/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>, </span><span class="where fmt-newline"> type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Result' class="type">Result</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>;</span></code><td><div class='out-of-band'><a class='srclink' href='../src/actix_web/extractor.rs.html#193-206' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
|
|||
|
<li><table class='table-display'><tbody><tr><td><code>impl<T, S> FromRequest<S> for <a class="struct" href="../actix_web/struct.Form.html" title="struct actix_web::Form">Form</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://docs.rs/serde/1.0.70/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a> + 'static,<br> S: 'static, </span><span class="where fmt-newline"> type <a href='#associatedtype.Config' class="type">Config</a> = <a class="struct" href="../actix_web/dev/struct.FormConfig.html" title="struct actix_web::dev::FormConfig">FormConfig</a><S>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = Self, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>>;</span></code><td><div class='out-of-band'><a class='srclink' href='../src/actix_web/extractor.rs.html#272-291' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
|
|||
|
<li><table class='table-display'><tbody><tr><td><code>impl<S> FromRequest<S> for <a class="struct" href="../actix_web/struct.State.html" title="struct actix_web::State">State</a><S><span class="where fmt-newline"> type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="../actix_web/struct.State.html" title="struct actix_web::State">State</a><S>;</span></code><td><div class='out-of-band'><a class='srclink' href='../src/actix_web/handler.rs.html#551-559' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
|
|||
|
<li><table class='table-display'><tbody><tr><td><code>impl<S> FromRequest<S> for <a class="struct" href="../actix_web/struct.HttpRequest.html" title="struct actix_web::HttpRequest">HttpRequest</a><S><span class="where fmt-newline"> type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Result' class="type">Result</a> = Self;</span></code><td><div class='out-of-band'><a class='srclink' href='../src/actix_web/httprequest.rs.html#335-343' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
|
|||
|
<li><table class='table-display'><tbody><tr><td><code>impl<T, S> FromRequest<S> for <a class="struct" href="../actix_web/struct.Json.html" title="struct actix_web::Json">Json</a><T> <span class="where fmt-newline">where<br> T: <a class="trait" href="https://docs.rs/serde/1.0.70/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a> + 'static,<br> S: 'static, </span><span class="where fmt-newline"> type <a href='#associatedtype.Config' class="type">Config</a> = <a class="struct" href="../actix_web/dev/struct.JsonConfig.html" title="struct actix_web::dev::JsonConfig">JsonConfig</a><S>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><<a class="trait" href="https://docs.rs/futures/0.1/futures/future/trait.Future.html" title="trait futures::future::Future">Future</a><Item = Self, Error = <a class="struct" href="../actix_web/error/struct.Error.html" title="struct actix_web::error::Error">Error</a>>>;</span></code><td><div class='out-of-band'><a class='srclink' href='../src/actix_web/json.rs.html#133-152' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
|
|||
|
<li><table class='table-display'><tbody><tr><td><code>impl<S> FromRequest<S> for <a class="struct" href="../actix_web/middleware/session/struct.Session.html" title="struct actix_web::middleware::session::Session">Session</a><span class="where fmt-newline"> type <a href='#associatedtype.Config' class="type">Config</a> = <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>;</span><span class="where fmt-newline"> type <a href='#associatedtype.Result' class="type">Result</a> = <a class="struct" href="../actix_web/middleware/session/struct.Session.html" title="struct actix_web::middleware::session::Session">Session</a>;</span></code><td><div class='out-of-band'><a class='srclink' href='../src/actix_web/middleware/session.rs.html#212-220' title='goto source code'>[src]</a></div></td></tr></tbody></table></li>
|
|||
|
</ul><script type="text/javascript">window.inlined_types=new Set([]);</script><script type="text/javascript" async
|
|||
|
src="../implementors/actix_web/trait.FromRequest.js">
|
|||
|
</script></section><section id="search" class="content hidden"></section><section class="footer"></section><aside id="help" class="hidden"><div><h1 class="hidden">Help</h1><div class="shortcuts"><h2>Keyboard Shortcuts</h2><dl><dt><kbd>?</kbd></dt><dd>Show this help dialog</dd><dt><kbd>S</kbd></dt><dd>Focus the search field</dd><dt><kbd>↑</kbd></dt><dd>Move up in search results</dd><dt><kbd>↓</kbd></dt><dd>Move down in search results</dd><dt><kbd>↹</kbd></dt><dd>Switch tab</dd><dt><kbd>⏎</kbd></dt><dd>Go to active search result</dd><dt><kbd>+</kbd></dt><dd>Expand all sections</dd><dt><kbd>-</kbd></dt><dd>Collapse all sections</dd></dl></div><div class="infos"><h2>Search Tricks</h2><p>Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type.</p><p>Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>.</p><p>Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>)</p><p>Search multiple things at once by splitting your query with comma (e.g. <code>str,u8</code> or <code>String,struct:Vec,test</code>)</p></div></div></aside><script>window.rootPath = "../";window.currentCrate = "actix_web";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>
|