mirror of
https://github.com/actix/actix-extras.git
synced 2025-01-22 23:05:56 +01:00
Deploying to gh-pages from @ 798a5d6d0e48de06e2bd9ac1a48098110aabbdca 🚀
This commit is contained in:
parent
0c14dfbe8c
commit
9210aa9b4c
File diff suppressed because one or more lines are too long
@ -3,17 +3,17 @@
|
||||
<a href="struct.Cors.html" title="Cors"><code>Cors</code></a> builder can be used as an argument for Actix Web’s <code>App::wrap()</code>,
|
||||
<code>Scope::wrap()</code>, or <code>Resource::wrap()</code> methods.</p>
|
||||
<p>This CORS middleware automatically handles <code>OPTIONS</code> preflight requests.</p>
|
||||
<h1 id="example" class="section-header"><a href="#example">Example</a></h1>
|
||||
<h2 id="example" class="section-header"><a href="#example">Example</a></h2>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">actix_cors::Cors</span>;
|
||||
<span class="kw">use</span> <span class="ident">actix_web</span>::{<span class="ident">get</span>, <span class="ident">http</span>, <span class="ident">web</span>, <span class="ident">App</span>, <span class="ident">HttpRequest</span>, <span class="ident">HttpResponse</span>, <span class="ident">HttpServer</span>};
|
||||
|
||||
<span class="attribute">#[<span class="ident">get</span>(<span class="string">"/index.html"</span>)]</span>
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">req</span>: <span class="ident">HttpRequest</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="lifetime">'static</span> <span class="ident">str</span> {
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">req</span>: <span class="ident">HttpRequest</span>) -> <span class="kw-2">&</span><span class="lifetime">'static</span> <span class="ident">str</span> {
|
||||
<span class="string">"<p>Hello World!</p>"</span>
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">actix_web::main</span>]</span>
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">main</span>() <span class="op">-</span><span class="op">></span> <span class="ident">std::io::Result</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">main</span>() -> <span class="ident">std::io::Result</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="ident">HttpServer::new</span>(<span class="op">|</span><span class="op">|</span> {
|
||||
<span class="kw">let</span> <span class="ident">cors</span> <span class="op">=</span> <span class="ident">Cors::default</span>()
|
||||
.<span class="ident">allowed_origin</span>(<span class="string">"https://www.rust-lang.org/"</span>)
|
||||
@ -36,9 +36,9 @@
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}</code></pre></div>
|
||||
</div></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.Cors.html" title="actix_cors::Cors struct">Cors</a></div><div class="item-right docblock-short"><p>Builder for CORS middleware.</p>
|
||||
</div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="enum" href="enum.CorsError.html" title="actix_cors::CorsError enum">CorsError</a></div><div class="item-right docblock-short"><p>Errors that can occur when processing CORS guarded requests.</p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_cors" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Cors.html" title="actix_cors::Cors struct">Cors</a></div><div class="item-right docblock-short"><p>Builder for CORS middleware.</p>
|
||||
</div></div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.CorsError.html" title="actix_cors::CorsError enum">CorsError</a></div><div class="item-right docblock-short"><p>Errors that can occur when processing CORS guarded requests.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_cors" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
@ -8,7 +8,7 @@ identity information.</p>
|
||||
<span class="kw">use</span> <span class="ident">actix_identity</span>::{<span class="ident">Identity</span>, <span class="ident">CookieIdentityPolicy</span>, <span class="ident">IdentityService</span>};
|
||||
|
||||
<span class="attribute">#[<span class="ident">get</span>(<span class="string">"/"</span>)]</span>
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">id</span>: <span class="ident">Identity</span>) <span class="op">-</span><span class="op">></span> <span class="ident">String</span> {
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">id</span>: <span class="ident">Identity</span>) -> <span class="ident">String</span> {
|
||||
<span class="comment">// access request identity</span>
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">id</span>) <span class="op">=</span> <span class="ident">id</span>.<span class="ident">identity</span>() {
|
||||
<span class="macro">format!</span>(<span class="string">"Welcome! {}"</span>, <span class="ident">id</span>)
|
||||
@ -18,13 +18,13 @@ identity information.</p>
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">post</span>(<span class="string">"/login"</span>)]</span>
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">login</span>(<span class="ident">id</span>: <span class="ident">Identity</span>) <span class="op">-</span><span class="op">></span> <span class="ident">HttpResponse</span> {
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">login</span>(<span class="ident">id</span>: <span class="ident">Identity</span>) -> <span class="ident">HttpResponse</span> {
|
||||
<span class="ident">id</span>.<span class="ident">remember</span>(<span class="string">"User1"</span>.<span class="ident">to_owned</span>()); <span class="comment">// <- remember identity</span>
|
||||
<span class="ident">HttpResponse::Ok</span>().<span class="ident">finish</span>()
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">post</span>(<span class="string">"/logout"</span>)]</span>
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">logout</span>(<span class="ident">id</span>: <span class="ident">Identity</span>) <span class="op">-</span><span class="op">></span> <span class="ident">HttpResponse</span> {
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">logout</span>(<span class="ident">id</span>: <span class="ident">Identity</span>) -> <span class="ident">HttpResponse</span> {
|
||||
<span class="ident">id</span>.<span class="ident">forget</span>(); <span class="comment">// <- remove identity</span>
|
||||
<span class="ident">HttpResponse::Ok</span>().<span class="ident">finish</span>()
|
||||
}
|
||||
@ -39,12 +39,12 @@ identity information.</p>
|
||||
.<span class="ident">wrap</span>(<span class="ident">IdentityService::new</span>(<span class="ident">policy</span>))
|
||||
.<span class="ident">service</span>(<span class="macro">services!</span>[<span class="ident">index</span>, <span class="ident">login</span>, <span class="ident">logout</span>]);</code></pre></div>
|
||||
</div></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.CookieIdentityPolicy.html" title="actix_identity::CookieIdentityPolicy struct">CookieIdentityPolicy</a></div><div class="item-right docblock-short"><p>Use cookies for request identity storage.</p>
|
||||
</div><div class="item-left module-item"><a class="struct" href="struct.Identity.html" title="actix_identity::Identity struct">Identity</a></div><div class="item-right docblock-short"><p>The extractor type to obtain your identity from a request.</p>
|
||||
</div><div class="item-left module-item"><a class="struct" href="struct.IdentityService.html" title="actix_identity::IdentityService struct">IdentityService</a></div><div class="item-right docblock-short"><p>Request identity middleware</p>
|
||||
</div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="trait" href="trait.IdentityPolicy.html" title="actix_identity::IdentityPolicy trait">IdentityPolicy</a></div><div class="item-right docblock-short"><p>Identity policy.</p>
|
||||
</div><div class="item-left module-item"><a class="trait" href="trait.RequestIdentity.html" title="actix_identity::RequestIdentity trait">RequestIdentity</a></div><div class="item-right docblock-short"><p>Helper trait that allows to get Identity.</p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_identity" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.CookieIdentityPolicy.html" title="actix_identity::CookieIdentityPolicy struct">CookieIdentityPolicy</a></div><div class="item-right docblock-short"><p>Use cookies for request identity storage.</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Identity.html" title="actix_identity::Identity struct">Identity</a></div><div class="item-right docblock-short"><p>The extractor type to obtain your identity from a request.</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.IdentityService.html" title="actix_identity::IdentityService struct">IdentityService</a></div><div class="item-right docblock-short"><p>Request identity middleware</p>
|
||||
</div></div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.IdentityPolicy.html" title="actix_identity::IdentityPolicy trait">IdentityPolicy</a></div><div class="item-right docblock-short"><p>Identity policy.</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.RequestIdentity.html" title="actix_identity::RequestIdentity trait">RequestIdentity</a></div><div class="item-right docblock-short"><p>Helper trait that allows to get Identity.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_identity" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
<!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="Request identity middleware"><meta name="keywords" content="rust, rustlang, rust-lang, IdentityService"><title>IdentityService in actix_identity - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_identity/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Struct IdentityService</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#implementations">Methods</a></h3><div class="sidebar-links"><a href="#method.new">new</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-Transform%3CS%2C%20ServiceRequest%3E">Transform<S, ServiceRequest></a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Instrument">Instrument</a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-Same%3CT%3E">Same<T></a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a></div></div><h2 class="location">Other items in<br><a href="index.html">actix_identity</a></h2><div id="sidebar-vars" data-name="IdentityService" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="index.html">actix_identity</a>::<wbr><a class="struct" href="#">IdentityService</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_identity/middleware.rs.html#27-29" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust struct"><code>pub struct IdentityService<T> { /* fields omitted */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Request identity middleware</p>
|
||||
<!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="Request identity middleware"><meta name="keywords" content="rust, rustlang, rust-lang, IdentityService"><title>IdentityService in actix_identity - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_identity/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Struct IdentityService</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#implementations">Methods</a></h3><div class="sidebar-links"><a href="#method.new">new</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-Transform%3CS%2C%20ServiceRequest%3E">Transform<S, ServiceRequest></a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Instrument">Instrument</a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-Same%3CT%3E">Same<T></a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a><a href="#impl-WithSubscriber">WithSubscriber</a></div></div><h2 class="location">Other items in<br><a href="index.html">actix_identity</a></h2><div id="sidebar-vars" data-name="IdentityService" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="index.html">actix_identity</a>::<wbr><a class="struct" href="#">IdentityService</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_identity/middleware.rs.html#27-29" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust struct"><code>pub struct IdentityService<T> { /* fields omitted */ }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Request identity middleware</p>
|
||||
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">actix_web::App</span>;
|
||||
<span class="kw">use</span> <span class="ident">actix_identity</span>::{<span class="ident">CookieIdentityPolicy</span>, <span class="ident">IdentityService</span>};
|
||||
@ -22,16 +22,20 @@
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Borrow%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208-213" title="goto source code">[src]</a></div><a href="#impl-Borrow%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#210" title="goto source code">[src]</a></div><a href="#method.borrow" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</h4></div></summary><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-BorrowMut%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#216-220" title="goto source code">[src]</a></div><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow_mut" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217" title="goto source code">[src]</a></div><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</h4></div></summary><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546-550" title="goto source code">[src]</a></div><a href="#impl-From%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#547" title="goto source code">[src]</a></div><a href="#method.from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Instrument" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#155" title="goto source code">[src]</a></div><a href="#impl-Instrument" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.instrument" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#38" title="goto source code">[src]</a></div><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -> <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the provided <code>Span</code>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.in_current_span" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#74" title="goto source code">[src]</a></div><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the <a href="../struct.Span.html#method.current">current</a> <code>Span</code>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Instrument" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#276" title="goto source code">[src]</a></div><a href="#impl-Instrument" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.instrument" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#82" title="goto source code">[src]</a></div><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the provided <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html" title="Span"><code>Span</code></a>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.in_current_span" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#121" title="goto source code">[src]</a></div><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html#method.current">current</a> <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html"><code>Span</code></a>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Into%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#535-542" title="goto source code">[src]</a></div><a href="#impl-Into%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#539" title="goto source code">[src]</a></div><a href="#method.into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Same%3CT%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Same%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> Same<T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Output" class="type trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Output" class="type">Output</a> = T</h4></div></summary><div class='docblock'><p>Should always be <code>Self</code></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Same%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/typenum/1.14.0/src/typenum/type_operators.rs.html#34-36" title="goto source code">[src]</a></div><a href="#impl-Same%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/typenum/1.14.0/typenum/type_operators/trait.Same.html" title="trait typenum::type_operators::Same">Same</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Output" class="type trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a href="https://docs.rs/typenum/1.14.0/typenum/type_operators/trait.Same.html#associatedtype.Output" class="type">Output</a> = T</h4></div></summary><div class='docblock'><p>Should always be <code>Self</code></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryFrom%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#583-592" title="goto source code">[src]</a></div><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error-1" class="type trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#589" title="goto source code">[src]</a></div><a href="#method.try_from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryInto%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#569-578" title="goto source code">[src]</a></div><a href="#impl-TryInto%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error-2" class="type trait-impl has-srclink"><a href="#associatedtype.Error-2" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#575" title="goto source code">[src]</a></div><a href="#method.try_into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-VZip%3CV%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-VZip%3CV%3E" class="anchor"></a><h3 class="code-header in-band">impl<V, T> VZip<V> for T <span class="where fmt-newline">where<br> V: MultiLane<T>, </span></h3></div></summary><div class="impl-items"><div id="method.vzip" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.vzip" class="anchor"></a><h4 class="code-header">pub fn <a class="fnname">vzip</a>(self) -> V</h4></div></div></details></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_identity" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-VZip%3CV%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-VZip%3CV%3E" class="anchor"></a><h3 class="code-header in-band">impl<V, T> VZip<V> for T <span class="where fmt-newline">where<br> V: MultiLane<T>, </span></h3></div></summary><div class="impl-items"><div id="method.vzip" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.vzip" class="anchor"></a><h4 class="code-header">pub fn <a class="fnname">vzip</a>(self) -> V</h4></div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-WithSubscriber" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#334" title="goto source code">[src]</a></div><a href="#impl-WithSubscriber" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html" title="trait tracing::instrument::WithSubscriber">WithSubscriber</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_subscriber" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#169-171" title="goto source code">[src]</a></div><a href="#method.with_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber" class="fnname">with_subscriber</a><S>(self, subscriber: S) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self> <span class="where fmt-newline">where<br> S: <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="https://docs.rs/tracing-core/0.1.21/tracing_core/dispatcher/struct.Dispatch.html" title="struct tracing_core::dispatcher::Dispatch">Dispatch</a>>, </span></h4></div></summary><div class='docblock'><p>Attaches the provided <a href="https://docs.rs/tracing-core/0.1.21/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
|
||||
<a href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_current_subscriber" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#221" title="goto source code">[src]</a></div><a href="#method.with_current_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber" class="fnname">with_current_subscriber</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self></h4></div></summary><div class='docblock'><p>Attaches the current <a href="https://docs.rs/tracing/0.1.29/tracing/dispatcher/index.html#setting-the-default-subscriber">default</a> <a href="https://docs.rs/tracing-core/0.1.21/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
|
||||
<a href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber">Read more</a></p>
|
||||
</div></details></div></details></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_identity" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
@ -8,6 +8,6 @@
|
||||
</div></details><details class="rustdoc-toggle" open><summary><div id="associatedtype.ResponseFuture" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_identity/lib.rs.html#70" title="goto source code">[src]</a></div><h4 class="code-header">type <a href="#associatedtype.ResponseFuture" class="type">ResponseFuture</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = Result<<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Error>></h4></div></summary><div class="docblock"><p>The return type of the middleware</p>
|
||||
</div></details></div><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.from_request" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_identity/lib.rs.html#73" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.from_request" class="fnname">from_request</a>(&self, req: &mut ServiceRequest) -> Self::<a class="type" href="trait.IdentityPolicy.html#associatedtype.Future" title="type actix_identity::IdentityPolicy::Future">Future</a></h4></div></summary><div class="docblock"><p>Parse the session from request and load data from a service identity.</p>
|
||||
</div></details><details class="rustdoc-toggle" open><summary><div id="tymethod.to_response" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_identity/lib.rs.html#76-81" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.to_response" class="fnname">to_response</a><B>(<br> &self, <br> identity: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, <br> changed: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>, <br> response: &mut ServiceResponse<B><br>) -> Self::<a class="type" href="trait.IdentityPolicy.html#associatedtype.ResponseFuture" title="type actix_identity::IdentityPolicy::ResponseFuture">ResponseFuture</a></h4></div></summary><div class="docblock"><p>Write changes to response</p>
|
||||
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><div id="impl-IdentityPolicy" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_identity/cookie.rs.html#303-367" title="goto source code">[src]</a></div><a href="#impl-IdentityPolicy" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.IdentityPolicy.html" title="trait actix_identity::IdentityPolicy">IdentityPolicy</a> for <a class="struct" href="struct.CookieIdentityPolicy.html" title="struct actix_identity::CookieIdentityPolicy">CookieIdentityPolicy</a></h3></div></div><script type="text/javascript" src="../implementors/actix_identity/trait.IdentityPolicy.js" async></script></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_identity" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-IdentityPolicy" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_identity/cookie.rs.html#303-367" title="goto source code">[src]</a></div><a href="#impl-IdentityPolicy" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.IdentityPolicy.html" title="trait actix_identity::IdentityPolicy">IdentityPolicy</a> for <a class="struct" href="struct.CookieIdentityPolicy.html" title="struct actix_identity::CookieIdentityPolicy">CookieIdentityPolicy</a></h3></div></summary><div class="impl-items"><div id="associatedtype.Future-1" class="type trait-impl has-srclink"><a href="#associatedtype.Future-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Future" class="type">Future</a> = Ready<Result<<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>, Error>></h4></div><div id="associatedtype.ResponseFuture-1" class="type trait-impl has-srclink"><a href="#associatedtype.ResponseFuture-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.ResponseFuture" class="type">ResponseFuture</a> = Ready<Result<<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, Error>></h4></div></div></details></div><script type="text/javascript" src="../implementors/actix_identity/trait.IdentityPolicy.js" async></script></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_identity" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
<!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 `actix_protobuf` crate."><meta name="keywords" content="rust, rustlang, rust-lang, actix_protobuf"><title>actix_protobuf - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_protobuf/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Crate actix_protobuf</h2><div class="block version"><div class="narrow-helper"></div><p>Version 0.7.0-beta.1</p></div><div class="sidebar-elems"><a id="all-types" href="all.html"><p>See all actix_protobuf's items</p></a><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li></ul></div><div id="sidebar-vars" data-name="actix_protobuf" data-ty="mod" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">actix_protobuf</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_protobuf/lib.rs.html#1-327" title="goto source code">[src]</a></span></h1><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.ProtoBuf.html" title="actix_protobuf::ProtoBuf struct">ProtoBuf</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="struct" href="struct.ProtoBufConfig.html" title="actix_protobuf::ProtoBufConfig struct">ProtoBufConfig</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="struct" href="struct.ProtoBufMessage.html" title="actix_protobuf::ProtoBufMessage struct">ProtoBufMessage</a></div><div class="item-right docblock-short"></div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="enum" href="enum.ProtoBufPayloadError.html" title="actix_protobuf::ProtoBufPayloadError enum">ProtoBufPayloadError</a></div><div class="item-right docblock-short"></div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="trait" href="trait.ProtoBufResponseBuilder.html" title="actix_protobuf::ProtoBufResponseBuilder trait">ProtoBufResponseBuilder</a></div><div class="item-right docblock-short"></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_protobuf" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ProtoBuf.html" title="actix_protobuf::ProtoBuf struct">ProtoBuf</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ProtoBufConfig.html" title="actix_protobuf::ProtoBufConfig struct">ProtoBufConfig</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ProtoBufMessage.html" title="actix_protobuf::ProtoBufMessage struct">ProtoBufMessage</a></div><div class="item-right docblock-short"></div></div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.ProtoBufPayloadError.html" title="actix_protobuf::ProtoBufPayloadError enum">ProtoBufPayloadError</a></div><div class="item-right docblock-short"></div></div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.ProtoBufResponseBuilder.html" title="actix_protobuf::ProtoBufResponseBuilder trait">ProtoBufResponseBuilder</a></div><div class="item-right docblock-short"></div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_protobuf" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
<!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 `ProtoBufResponseBuilder` trait in crate `actix_protobuf`."><meta name="keywords" content="rust, rustlang, rust-lang, ProtoBufResponseBuilder"><title>ProtoBufResponseBuilder in actix_protobuf - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></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="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_protobuf/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Trait ProtoBufResponseBuilder</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#required-methods">Required Methods</a></h3><div class="sidebar-links"><a href="#tymethod.protobuf">protobuf</a></div><h3 class="sidebar-title"><a href="#foreign-impls">Implementations on Foreign Types</a></h3><div class="sidebar-links"><a href="#impl-ProtoBufResponseBuilder-for-HttpResponseBuilder">HttpResponseBuilder</a></div><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div><h2 class="location">Other items in<br><a href="index.html">actix_protobuf</a></h2><div id="sidebar-vars" data-name="ProtoBufResponseBuilder" data-ty="trait" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Trait <a href="index.html">actix_protobuf</a>::<wbr><a class="trait" href="#">ProtoBufResponseBuilder</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_protobuf/lib.rs.html#250-252" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust trait"><code>pub trait ProtoBufResponseBuilder {
|
||||
fn <a href="#tymethod.protobuf" class="fnname">protobuf</a><T: <a class="trait" href="https://docs.rs/prost/0.7.0/prost/message/trait.Message.html" title="trait prost::message::Message">Message</a>>(&mut self, value: T) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><HttpResponse, Error>;
|
||||
}</code></pre></div><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><div id="tymethod.protobuf" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_protobuf/lib.rs.html#251" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.protobuf" class="fnname">protobuf</a><T: <a class="trait" href="https://docs.rs/prost/0.7.0/prost/message/trait.Message.html" title="trait prost::message::Message">Message</a>>(&mut self, value: T) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><HttpResponse, Error></h4></div></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-ProtoBufResponseBuilder-for-HttpResponseBuilder" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_protobuf/lib.rs.html#254-264" title="goto source code">[src]</a></div><a href="#impl-ProtoBufResponseBuilder-for-HttpResponseBuilder" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.ProtoBufResponseBuilder.html" title="trait actix_protobuf::ProtoBufResponseBuilder">ProtoBufResponseBuilder</a> for HttpResponseBuilder</h3></div></summary><div class="impl-items"><div id="method.protobuf" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_protobuf/lib.rs.html#255-263" title="goto source code">[src]</a></div><a href="#method.protobuf" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.protobuf" class="fnname">protobuf</a><T: <a class="trait" href="https://docs.rs/prost/0.7.0/prost/message/trait.Message.html" title="trait prost::message::Message">Message</a>>(&mut self, value: T) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><HttpResponse, Error></h4></div></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/actix_protobuf/trait.ProtoBufResponseBuilder.js" async></script></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_protobuf" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
}</code></pre></div><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><div id="tymethod.protobuf" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_protobuf/lib.rs.html#251" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.protobuf" class="fnname">protobuf</a><T: <a class="trait" href="https://docs.rs/prost/0.7.0/prost/message/trait.Message.html" title="trait prost::message::Message">Message</a>>(&mut self, value: T) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><HttpResponse, Error></h4></div></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-ProtoBufResponseBuilder-for-HttpResponseBuilder" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_protobuf/lib.rs.html#254-264" title="goto source code">[src]</a></div><a href="#impl-ProtoBufResponseBuilder-for-HttpResponseBuilder" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.ProtoBufResponseBuilder.html" title="trait actix_protobuf::ProtoBufResponseBuilder">ProtoBufResponseBuilder</a> for HttpResponseBuilder</h3></div></summary><div class="impl-items"><div id="method.protobuf" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_protobuf/lib.rs.html#255-263" title="goto source code">[src]</a></div><a href="#method.protobuf" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.protobuf" class="fnname">protobuf</a><T: <a class="trait" href="https://docs.rs/prost/0.7.0/prost/message/trait.Message.html" title="trait prost::message::Message">Message</a>>(&mut self, value: T) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><HttpResponse, Error></h4></div></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/actix_protobuf/trait.ProtoBufResponseBuilder.js" async></script></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_protobuf" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
@ -1,34 +1,38 @@
|
||||
<!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="General purpose actix redis error"><meta name="keywords" content="rust, rustlang, rust-lang, Error"><title>Error in actix_redis - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc enum"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_redis/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Enum Error</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#variants">Variants</a></h3><div class="sidebar-links"><a href="#variant.Disconnected">Disconnected</a><a href="#variant.NotConnected">NotConnected</a><a href="#variant.Redis">Redis</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Display">Display</a><a href="#impl-Error">Error</a><a href="#impl-From%3CError%3E">From<Error></a><a href="#impl-ResponseError">ResponseError</a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Instrument">Instrument</a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-Same%3CT%3E">Same<T></a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a></div></div><h2 class="location">Other items in<br><a href="index.html">actix_redis</a></h2><div id="sidebar-vars" data-name="Error" data-ty="enum" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Enum <a href="index.html">actix_redis</a>::<wbr><a class="enum" href="#">Error</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_redis/lib.rs.html#19-28" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust enum"><code>pub enum Error {
|
||||
<!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="General purpose actix redis error"><meta name="keywords" content="rust, rustlang, rust-lang, Error"><title>Error in actix_redis - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc enum"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_redis/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Enum Error</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#variants">Variants</a></h3><div class="sidebar-links"><a href="#variant.Disconnected">Disconnected</a><a href="#variant.NotConnected">NotConnected</a><a href="#variant.Redis">Redis</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Display">Display</a><a href="#impl-Error">Error</a><a href="#impl-From%3CError%3E">From<Error></a><a href="#impl-ResponseError">ResponseError</a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Instrument">Instrument</a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-Same%3CT%3E">Same<T></a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a><a href="#impl-WithSubscriber">WithSubscriber</a></div></div><h2 class="location">Other items in<br><a href="index.html">actix_redis</a></h2><div id="sidebar-vars" data-name="Error" data-ty="enum" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Enum <a href="index.html">actix_redis</a>::<wbr><a class="enum" href="#">Error</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_redis/lib.rs.html#19-28" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust enum"><code>pub enum Error {
|
||||
Redis(<a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a>),
|
||||
NotConnected,
|
||||
Disconnected,
|
||||
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>General purpose actix redis error</p>
|
||||
</div></details><h2 id="variants" class="variants small-section-header">Variants<a href="#variants" class="anchor"></a></h2><div id="variant.Redis" class="variant small-section-header"><a href="#variant.Redis" class="anchor field"></a><code>Redis</code></div><div class="sub-variant" id="variant.Redis.fields"><h3>Tuple Fields of <b>Redis</b></h3><div><span id="variant.Redis.field.0" class="variant small-section-header"><a href="#variant.Redis.field.0" class="anchor field"></a><code>0: <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a></code></span></div></div><div id="variant.NotConnected" class="variant small-section-header"><a href="#variant.NotConnected" class="anchor field"></a><code>NotConnected</code></div><div class="docblock"><p>Receiving message during reconnecting</p>
|
||||
</div></details><h2 id="variants" class="variants small-section-header">Variants<a href="#variants" class="anchor"></a></h2><div id="variant.Redis" class="variant small-section-header"><a href="#variant.Redis" class="anchor field"></a><code>Redis(<a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a>)</code></div><div class="sub-variant" id="variant.Redis.fields"><h3>Tuple Fields of <b>Redis</b></h3><div><span id="variant.Redis.field.0" class="variant small-section-header"><a href="#variant.Redis.field.0" class="anchor field"></a><code>0: <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a></code></span></div></div><div id="variant.NotConnected" class="variant small-section-header"><a href="#variant.NotConnected" class="anchor field"></a><code>NotConnected</code></div><div class="docblock"><p>Receiving message during reconnecting</p>
|
||||
</div><div id="variant.Disconnected" class="variant small-section-header"><a href="#variant.Disconnected" class="anchor field"></a><code>Disconnected</code></div><div class="docblock"><p>Cancel all waters when connection get dropped</p>
|
||||
</div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Debug" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#18" title="goto source code">[src]</a></div><a href="#impl-Debug" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#18" title="goto source code">[src]</a></div><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Display" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#18" title="goto source code">[src]</a></div><a href="#impl-Display" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#18" title="goto source code">[src]</a></div><a href="#method.fmt-1" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&self, _derive_more_display_formatter: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Error" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#18" title="goto source code">[src]</a></div><a href="#impl-Error" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.source" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#18" title="goto source code">[src]</a></div><a href="#method.source" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.source" class="fnname">source</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&(dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static)></h4></div></summary><div class='docblock'><p>The lower-level source of this error, if any. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.source">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.backtrace" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#134" title="goto source code">[src]</a></div><a href="#method.backtrace" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace" class="fnname">backtrace</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="https://doc.rust-lang.org/nightly/std/backtrace/struct.Backtrace.html" title="struct std::backtrace::Backtrace">Backtrace</a>></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>backtrace</code>)</div></div><div class='docblock'><p>Returns a stack backtrace, if available, of where this error occurred. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.description" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#146" title="goto source code">[src]</a></div><a href="#method.description" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description" class="fnname">description</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></div></summary><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.42.0: <p>use the Display impl or to_string()</p>
|
||||
</div></div><div class='docblock'> <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.cause" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#156" title="goto source code">[src]</a></div><a href="#method.cause" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.cause" class="fnname">cause</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a>></h4></div></summary><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.33.0: <p>replaced by Error::source, which can support downcasting</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.backtrace" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#135" title="goto source code">[src]</a></div><a href="#method.backtrace" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace" class="fnname">backtrace</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="https://doc.rust-lang.org/nightly/std/backtrace/struct.Backtrace.html" title="struct std::backtrace::Backtrace">Backtrace</a>></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>backtrace</code>)</div></div><div class='docblock'><p>Returns a stack backtrace, if available, of where this error occurred. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.description" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#147" title="goto source code">[src]</a></div><a href="#method.description" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description" class="fnname">description</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></div></summary><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.42.0: <p>use the Display impl or to_string()</p>
|
||||
</div></div><div class='docblock'> <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.cause" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#157" title="goto source code">[src]</a></div><a href="#method.cause" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.cause" class="fnname">cause</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a>></h4></div></summary><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.33.0: <p>replaced by Error::source, which can support downcasting</p>
|
||||
</div></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CError%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#18" title="goto source code">[src]</a></div><a href="#impl-From%3CError%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a>> for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#18" title="goto source code">[src]</a></div><a href="#method.from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(original: <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a>) -> <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-ResponseError" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#31" title="goto source code">[src]</a></div><a href="#impl-ResponseError" class="anchor"></a><h3 class="code-header in-band">impl ResponseError for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.status_code" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.status_code" class="anchor"></a><h4 class="code-header">fn <a href="#method.status_code" class="fnname">status_code</a>(&self) -> <a class="struct" href="https://docs.rs/http/0.2.4/http/status/struct.StatusCode.html" title="struct http::status::StatusCode">StatusCode</a></h4></div></summary><div class='docblock'><p>Returns appropriate status code for error. <a href="#method.status_code">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-ResponseError" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#31" title="goto source code">[src]</a></div><a href="#impl-ResponseError" class="anchor"></a><h3 class="code-header in-band">impl ResponseError for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.status_code" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.status_code" class="anchor"></a><h4 class="code-header">fn <a href="#method.status_code" class="fnname">status_code</a>(&self) -> <a class="struct" href="https://docs.rs/http/0.2.5/http/status/struct.StatusCode.html" title="struct http::status::StatusCode">StatusCode</a></h4></div></summary><div class='docblock'><p>Returns appropriate status code for error. <a href="#method.status_code">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.error_response" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.error_response" class="anchor"></a><h4 class="code-header">fn <a href="#method.error_response" class="fnname">error_response</a>(&self) -> HttpResponse<AnyBody></h4></div></summary><div class='docblock'><p>Creates full response for error. <a href="#method.error_response">Read more</a></p>
|
||||
</div></details></div></details></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><div id="impl-RefUnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-RefUnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div><div id="impl-Send" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Send" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div><div id="impl-Sync" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Sync" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div><div id="impl-Unpin" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Unpin" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div><div id="impl-UnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-UnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Any" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132-136" title="goto source code">[src]</a></div><a href="#impl-Any" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.type_id" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#133" title="goto source code">[src]</a></div><a href="#method.type_id" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></div></summary><div class='docblock'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Borrow%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208-213" title="goto source code">[src]</a></div><a href="#impl-Borrow%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#210" title="goto source code">[src]</a></div><a href="#method.borrow" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</h4></div></summary><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-BorrowMut%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#216-220" title="goto source code">[src]</a></div><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow_mut" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217" title="goto source code">[src]</a></div><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</h4></div></summary><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546-550" title="goto source code">[src]</a></div><a href="#impl-From%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#547" title="goto source code">[src]</a></div><a href="#method.from-1" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Instrument" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#155" title="goto source code">[src]</a></div><a href="#impl-Instrument" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.instrument" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#38" title="goto source code">[src]</a></div><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -> <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the provided <code>Span</code>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.in_current_span" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#74" title="goto source code">[src]</a></div><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the <a href="../struct.Span.html#method.current">current</a> <code>Span</code>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Instrument" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#276" title="goto source code">[src]</a></div><a href="#impl-Instrument" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.instrument" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#82" title="goto source code">[src]</a></div><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the provided <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html" title="Span"><code>Span</code></a>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.in_current_span" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#121" title="goto source code">[src]</a></div><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html#method.current">current</a> <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html"><code>Span</code></a>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Into%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#535-542" title="goto source code">[src]</a></div><a href="#impl-Into%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#539" title="goto source code">[src]</a></div><a href="#method.into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Same%3CT%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Same%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> Same<T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Output" class="type trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Output" class="type">Output</a> = T</h4></div></summary><div class='docblock'><p>Should always be <code>Self</code></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Same%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/typenum/1.14.0/src/typenum/type_operators.rs.html#34-36" title="goto source code">[src]</a></div><a href="#impl-Same%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/typenum/1.14.0/typenum/type_operators/trait.Same.html" title="trait typenum::type_operators::Same">Same</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Output" class="type trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a href="https://docs.rs/typenum/1.14.0/typenum/type_operators/trait.Same.html#associatedtype.Output" class="type">Output</a> = T</h4></div></summary><div class='docblock'><p>Should always be <code>Self</code></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-ToString" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2372-2386" title="goto source code">[src]</a></div><a href="#impl-ToString" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.to_string" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2378" title="goto source code">[src]</a></div><a href="#method.to_string" class="anchor"></a><h4 class="code-header">pub default fn <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string" class="fnname">to_string</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></div></summary><div class='docblock'><p>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryFrom%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#583-592" title="goto source code">[src]</a></div><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error" class="type trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#589" title="goto source code">[src]</a></div><a href="#method.try_from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryInto%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#569-578" title="goto source code">[src]</a></div><a href="#impl-TryInto%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error-1" class="type trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#575" title="goto source code">[src]</a></div><a href="#method.try_into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-VZip%3CV%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-VZip%3CV%3E" class="anchor"></a><h3 class="code-header in-band">impl<V, T> VZip<V> for T <span class="where fmt-newline">where<br> V: MultiLane<T>, </span></h3></div></summary><div class="impl-items"><div id="method.vzip" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.vzip" class="anchor"></a><h4 class="code-header">pub fn <a class="fnname">vzip</a>(self) -> V</h4></div></div></details></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_redis" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-VZip%3CV%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-VZip%3CV%3E" class="anchor"></a><h3 class="code-header in-band">impl<V, T> VZip<V> for T <span class="where fmt-newline">where<br> V: MultiLane<T>, </span></h3></div></summary><div class="impl-items"><div id="method.vzip" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.vzip" class="anchor"></a><h4 class="code-header">pub fn <a class="fnname">vzip</a>(self) -> V</h4></div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-WithSubscriber" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#334" title="goto source code">[src]</a></div><a href="#impl-WithSubscriber" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html" title="trait tracing::instrument::WithSubscriber">WithSubscriber</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_subscriber" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#169-171" title="goto source code">[src]</a></div><a href="#method.with_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber" class="fnname">with_subscriber</a><S>(self, subscriber: S) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self> <span class="where fmt-newline">where<br> S: <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="https://docs.rs/tracing-core/0.1.21/tracing_core/dispatcher/struct.Dispatch.html" title="struct tracing_core::dispatcher::Dispatch">Dispatch</a>>, </span></h4></div></summary><div class='docblock'><p>Attaches the provided <a href="https://docs.rs/tracing-core/0.1.21/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
|
||||
<a href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_current_subscriber" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#221" title="goto source code">[src]</a></div><a href="#method.with_current_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber" class="fnname">with_current_subscriber</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self></h4></div></summary><div class='docblock'><p>Attaches the current <a href="https://docs.rs/tracing/0.1.29/tracing/dispatcher/index.html#setting-the-default-subscriber">default</a> <a href="https://docs.rs/tracing-core/0.1.21/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
|
||||
<a href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber">Read more</a></p>
|
||||
</div></details></div></details></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_redis" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
@ -1,4 +1,4 @@
|
||||
<!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 `RespError` enum in crate `actix_redis`."><meta name="keywords" content="rust, rustlang, rust-lang, RespError"><title>RespError in actix_redis - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc enum"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_redis/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Enum RespError</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#variants">Variants</a></h3><div class="sidebar-links"><a href="#variant.Connection">Connection</a><a href="#variant.IO">IO</a><a href="#variant.Internal">Internal</a><a href="#variant.RESP">RESP</a><a href="#variant.Remote">Remote</a><a href="#variant.Unexpected">Unexpected</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Display">Display</a><a href="#impl-Error">Error</a><a href="#impl-From%3CError%3E">From<Error></a><a href="#impl-From%3CTrySendError%3CT%3E%3E">From<TrySendError<T>></a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Instrument">Instrument</a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-Same%3CT%3E">Same<T></a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a></div></div><h2 class="location">Other items in<br><a href="index.html">actix_redis</a></h2><div id="sidebar-vars" data-name="RespError" data-ty="enum" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Enum <a href="index.html">actix_redis</a>::<wbr><a class="enum" href="#">RespError</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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></span></h1><div class="docblock type-decl"><pre class="rust enum"><code>pub enum RespError {
|
||||
<!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 `RespError` enum in crate `actix_redis`."><meta name="keywords" content="rust, rustlang, rust-lang, RespError"><title>RespError in actix_redis - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc enum"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_redis/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Enum RespError</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#variants">Variants</a></h3><div class="sidebar-links"><a href="#variant.Connection">Connection</a><a href="#variant.IO">IO</a><a href="#variant.Internal">Internal</a><a href="#variant.RESP">RESP</a><a href="#variant.Remote">Remote</a><a href="#variant.Unexpected">Unexpected</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Display">Display</a><a href="#impl-Error">Error</a><a href="#impl-From%3CError%3E">From<Error></a><a href="#impl-From%3CTrySendError%3CT%3E%3E">From<TrySendError<T>></a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Instrument">Instrument</a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-Same%3CT%3E">Same<T></a><a href="#impl-ToString">ToString</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a><a href="#impl-WithSubscriber">WithSubscriber</a></div></div><h2 class="location">Other items in<br><a href="index.html">actix_redis</a></h2><div id="sidebar-vars" data-name="RespError" data-ty="enum" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Enum <a href="index.html">actix_redis</a>::<wbr><a class="enum" href="#">RespError</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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></span></h1><div class="docblock type-decl"><pre class="rust enum"><code>pub enum RespError {
|
||||
Internal(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>),
|
||||
IO(<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>),
|
||||
RESP(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="enum.RespValue.html" title="enum actix_redis::RespValue">RespValue</a>>),
|
||||
@ -6,22 +6,22 @@
|
||||
Connection(ConnectionReason),
|
||||
Unexpected(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>),
|
||||
}</code></pre></div><h2 id="variants" class="variants small-section-header">Variants<a href="#variants" class="anchor"></a></h2><div id="variant.Internal" class="variant small-section-header"><a href="#variant.Internal" class="anchor field"></a><code>Internal(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>)</code></div><div class="docblock"><p>A non-specific internal error that prevented an operation from completing</p>
|
||||
</div><div id="variant.IO" class="variant small-section-header"><a href="#variant.IO" class="anchor field"></a><code>IO(<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>)</code></div><div class="docblock"><p>An IO error occurred</p>
|
||||
</div><div id="variant.RESP" class="variant small-section-header"><a href="#variant.RESP" class="anchor field"></a><code>RESP(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="enum.RespValue.html" title="enum actix_redis::RespValue">RespValue</a>>)</code></div><div class="docblock"><p>A RESP parsing/serialising error occurred</p>
|
||||
</div><div id="variant.Remote" class="variant small-section-header"><a href="#variant.Remote" class="anchor field"></a><code>Remote(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>)</code></div><div class="docblock"><p>A remote error</p>
|
||||
</div><div id="variant.Connection" class="variant small-section-header"><a href="#variant.Connection" class="anchor field"></a><code>Connection(ConnectionReason)</code></div><div class="docblock"><p>Error creating a connection, or an error with a connection being closed unexpectedly</p>
|
||||
</div><div id="variant.Unexpected" class="variant small-section-header"><a href="#variant.Unexpected" class="anchor field"></a><code>Unexpected(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>)</code></div><div class="docblock"><p>An unexpected error. In this context “unexpected” means
|
||||
</div><div class="sub-variant" id="variant.Internal.fields"><h3>Tuple Fields of <b>Internal</b></h3><div><span id="variant.Internal.field.0" class="variant small-section-header"><a href="#variant.Internal.field.0" class="anchor field"></a><code>0: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code></span></div></div><div id="variant.IO" class="variant small-section-header"><a href="#variant.IO" class="anchor field"></a><code>IO(<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>)</code></div><div class="docblock"><p>An IO error occurred</p>
|
||||
</div><div class="sub-variant" id="variant.IO.fields"><h3>Tuple Fields of <b>IO</b></h3><div><span id="variant.IO.field.0" class="variant small-section-header"><a href="#variant.IO.field.0" class="anchor field"></a><code>0: <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a></code></span></div></div><div id="variant.RESP" class="variant small-section-header"><a href="#variant.RESP" class="anchor field"></a><code>RESP(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="enum.RespValue.html" title="enum actix_redis::RespValue">RespValue</a>>)</code></div><div class="docblock"><p>A RESP parsing/serialising error occurred</p>
|
||||
</div><div class="sub-variant" id="variant.RESP.fields"><h3>Tuple Fields of <b>RESP</b></h3><div><span id="variant.RESP.field.0" class="variant small-section-header"><a href="#variant.RESP.field.0" class="anchor field"></a><code>0: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code></span><span id="variant.RESP.field.1" class="variant small-section-header"><a href="#variant.RESP.field.1" class="anchor field"></a><code>1: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="enum" href="enum.RespValue.html" title="enum actix_redis::RespValue">RespValue</a>></code></span></div></div><div id="variant.Remote" class="variant small-section-header"><a href="#variant.Remote" class="anchor field"></a><code>Remote(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>)</code></div><div class="docblock"><p>A remote error</p>
|
||||
</div><div class="sub-variant" id="variant.Remote.fields"><h3>Tuple Fields of <b>Remote</b></h3><div><span id="variant.Remote.field.0" class="variant small-section-header"><a href="#variant.Remote.field.0" class="anchor field"></a><code>0: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code></span></div></div><div id="variant.Connection" class="variant small-section-header"><a href="#variant.Connection" class="anchor field"></a><code>Connection(ConnectionReason)</code></div><div class="docblock"><p>Error creating a connection, or an error with a connection being closed unexpectedly</p>
|
||||
</div><div class="sub-variant" id="variant.Connection.fields"><h3>Tuple Fields of <b>Connection</b></h3><div><span id="variant.Connection.field.0" class="variant small-section-header"><a href="#variant.Connection.field.0" class="anchor field"></a><code>0: ConnectionReason</code></span></div></div><div id="variant.Unexpected" class="variant small-section-header"><a href="#variant.Unexpected" class="anchor field"></a><code>Unexpected(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>)</code></div><div class="docblock"><p>An unexpected error. In this context “unexpected” means
|
||||
“unexpected because we check ahead of time”, it used to maintain the type signature of
|
||||
chains of futures; but it occurring at runtime should be considered a catastrophic
|
||||
failure.</p>
|
||||
<p>If any error is propagated this way that needs to be handled, then it should be made into
|
||||
a proper option.</p>
|
||||
</div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Debug" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Debug" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt-1" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.fmt-1" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Display" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Display" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.fmt" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
|
||||
</div><div class="sub-variant" id="variant.Unexpected.fields"><h3>Tuple Fields of <b>Unexpected</b></h3><div><span id="variant.Unexpected.field.0" class="variant small-section-header"><a href="#variant.Unexpected.field.0" class="anchor field"></a><code>0: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code></span></div></div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Debug" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Debug" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.fmt" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Display" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Display" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> for <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt-1" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.fmt-1" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</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="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Error.html" title="struct core::fmt::Error">Error</a>></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html#tymethod.fmt">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Error" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Error" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> for <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.source" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.source" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.source" class="fnname">source</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&(dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a> + 'static)></h4></div></summary><div class='docblock'><p>The lower-level source of this error, if any. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.source">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.backtrace" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#134" title="goto source code">[src]</a></div><a href="#method.backtrace" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace" class="fnname">backtrace</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="https://doc.rust-lang.org/nightly/std/backtrace/struct.Backtrace.html" title="struct std::backtrace::Backtrace">Backtrace</a>></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>backtrace</code>)</div></div><div class='docblock'><p>Returns a stack backtrace, if available, of where this error occurred. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.description" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#146" title="goto source code">[src]</a></div><a href="#method.description" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description" class="fnname">description</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></div></summary><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.42.0: <p>use the Display impl or to_string()</p>
|
||||
</div></div><div class='docblock'> <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.cause" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#156" title="goto source code">[src]</a></div><a href="#method.cause" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.cause" class="fnname">cause</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a>></h4></div></summary><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.33.0: <p>replaced by Error::source, which can support downcasting</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.backtrace" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#135" title="goto source code">[src]</a></div><a href="#method.backtrace" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace" class="fnname">backtrace</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&<a class="struct" href="https://doc.rust-lang.org/nightly/std/backtrace/struct.Backtrace.html" title="struct std::backtrace::Backtrace">Backtrace</a>></h4></div></summary><div class="item-info"><div class="stab unstable"><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>backtrace</code>)</div></div><div class='docblock'><p>Returns a stack backtrace, if available, of where this error occurred. <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.backtrace">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.description" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#147" title="goto source code">[src]</a></div><a href="#method.description" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description" class="fnname">description</a>(&self) -> &<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></h4></div></summary><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.42.0: <p>use the Display impl or to_string()</p>
|
||||
</div></div><div class='docblock'> <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.description">Read more</a></div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.cause" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/std/error.rs.html#157" title="goto source code">[src]</a></div><a href="#method.cause" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html#method.cause" class="fnname">cause</a>(&self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><&dyn <a class="trait" href="https://doc.rust-lang.org/nightly/std/error/trait.Error.html" title="trait std::error::Error">Error</a>></h4></div></summary><div class="item-info"><div class="stab deprecated"><span class="emoji">👎</span> Deprecated since 1.33.0: <p>replaced by Error::source, which can support downcasting</p>
|
||||
</div></div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CError%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-From%3CError%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>> for <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-1" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.from-1" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(err: <a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>) -> <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CError%3E-1" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#18" title="goto source code">[src]</a></div><a href="#impl-From%3CError%3E-1" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><<a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a>> for <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/lib.rs.html#18" title="goto source code">[src]</a></div><a href="#method.from-2" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(original: <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a>) -> <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CTrySendError%3CT%3E%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-From%3CTrySendError%3CT%3E%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><TrySendError<T>> for <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a> <span class="where fmt-newline">where<br> T: 'static + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(err: TrySendError<T>) -> <a class="enum" href="enum.RespError.html" title="enum actix_redis::RespError">Error</a></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
@ -29,17 +29,21 @@ a proper option.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Borrow%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208-213" title="goto source code">[src]</a></div><a href="#impl-Borrow%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#210" title="goto source code">[src]</a></div><a href="#method.borrow" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</h4></div></summary><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-BorrowMut%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#216-220" title="goto source code">[src]</a></div><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow_mut" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217" title="goto source code">[src]</a></div><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</h4></div></summary><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546-550" title="goto source code">[src]</a></div><a href="#impl-From%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from-3" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#547" title="goto source code">[src]</a></div><a href="#method.from-3" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Instrument" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#155" title="goto source code">[src]</a></div><a href="#impl-Instrument" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.instrument" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#38" title="goto source code">[src]</a></div><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -> <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the provided <code>Span</code>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.in_current_span" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#74" title="goto source code">[src]</a></div><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the <a href="../struct.Span.html#method.current">current</a> <code>Span</code>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Instrument" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#276" title="goto source code">[src]</a></div><a href="#impl-Instrument" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.instrument" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#82" title="goto source code">[src]</a></div><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the provided <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html" title="Span"><code>Span</code></a>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.in_current_span" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#121" title="goto source code">[src]</a></div><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html#method.current">current</a> <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html"><code>Span</code></a>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Into%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#535-542" title="goto source code">[src]</a></div><a href="#impl-Into%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#539" title="goto source code">[src]</a></div><a href="#method.into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Same%3CT%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Same%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> Same<T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Output" class="type trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Output" class="type">Output</a> = T</h4></div></summary><div class='docblock'><p>Should always be <code>Self</code></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Same%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/typenum/1.14.0/src/typenum/type_operators.rs.html#34-36" title="goto source code">[src]</a></div><a href="#impl-Same%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/typenum/1.14.0/typenum/type_operators/trait.Same.html" title="trait typenum::type_operators::Same">Same</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Output" class="type trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a href="https://docs.rs/typenum/1.14.0/typenum/type_operators/trait.Same.html#associatedtype.Output" class="type">Output</a> = T</h4></div></summary><div class='docblock'><p>Should always be <code>Self</code></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-ToString" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2372-2386" title="goto source code">[src]</a></div><a href="#impl-ToString" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html" title="trait alloc::string::ToString">ToString</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.to_string" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/string.rs.html#2378" title="goto source code">[src]</a></div><a href="#method.to_string" class="anchor"></a><h4 class="code-header">pub default fn <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string" class="fnname">to_string</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></h4></div></summary><div class='docblock'><p>Converts the given value to a <code>String</code>. <a href="https://doc.rust-lang.org/nightly/alloc/string/trait.ToString.html#tymethod.to_string">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryFrom%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#583-592" title="goto source code">[src]</a></div><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error" class="type trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#589" title="goto source code">[src]</a></div><a href="#method.try_from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryInto%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#569-578" title="goto source code">[src]</a></div><a href="#impl-TryInto%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error-1" class="type trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#575" title="goto source code">[src]</a></div><a href="#method.try_into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-VZip%3CV%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-VZip%3CV%3E" class="anchor"></a><h3 class="code-header in-band">impl<V, T> VZip<V> for T <span class="where fmt-newline">where<br> V: MultiLane<T>, </span></h3></div></summary><div class="impl-items"><div id="method.vzip" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.vzip" class="anchor"></a><h4 class="code-header">pub fn <a class="fnname">vzip</a>(self) -> V</h4></div></div></details></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_redis" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-VZip%3CV%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-VZip%3CV%3E" class="anchor"></a><h3 class="code-header in-band">impl<V, T> VZip<V> for T <span class="where fmt-newline">where<br> V: MultiLane<T>, </span></h3></div></summary><div class="impl-items"><div id="method.vzip" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.vzip" class="anchor"></a><h4 class="code-header">pub fn <a class="fnname">vzip</a>(self) -> V</h4></div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-WithSubscriber" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#334" title="goto source code">[src]</a></div><a href="#impl-WithSubscriber" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html" title="trait tracing::instrument::WithSubscriber">WithSubscriber</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_subscriber" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#169-171" title="goto source code">[src]</a></div><a href="#method.with_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber" class="fnname">with_subscriber</a><S>(self, subscriber: S) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self> <span class="where fmt-newline">where<br> S: <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="https://docs.rs/tracing-core/0.1.21/tracing_core/dispatcher/struct.Dispatch.html" title="struct tracing_core::dispatcher::Dispatch">Dispatch</a>>, </span></h4></div></summary><div class='docblock'><p>Attaches the provided <a href="https://docs.rs/tracing-core/0.1.21/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
|
||||
<a href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_current_subscriber" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#221" title="goto source code">[src]</a></div><a href="#method.with_current_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber" class="fnname">with_current_subscriber</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self></h4></div></summary><div class='docblock'><p>Attaches the current <a href="https://docs.rs/tracing/0.1.29/tracing/dispatcher/index.html#setting-the-default-subscriber">default</a> <a href="https://docs.rs/tracing-core/0.1.21/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
|
||||
<a href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber">Read more</a></p>
|
||||
</div></details></div></details></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_redis" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,12 +1,12 @@
|
||||
<!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="Redis integration for Actix and session store for Actix Web."><meta name="keywords" content="rust, rustlang, rust-lang, actix_redis"><title>actix_redis - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_redis/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Crate actix_redis</h2><div class="block version"><div class="narrow-helper"></div><p>Version 0.10.0-beta.2</p></div><div class="sidebar-elems"><a id="all-types" href="all.html"><p>See all actix_redis's items</p></a><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li></ul></div><div id="sidebar-vars" data-name="actix_redis" data-ty="mod" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">actix_redis</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_redis/lib.rs.html#1-35" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Redis integration for Actix and session store for Actix Web.</p>
|
||||
</div></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.Command.html" title="actix_redis::Command struct">Command</a></div><div class="item-right docblock-short"><p>Command for send data to Redis</p>
|
||||
</div><div class="item-left module-item"><a class="struct" href="struct.RedisActor.html" title="actix_redis::RedisActor struct">RedisActor</a></div><div class="item-right docblock-short"><p>Redis communication actor</p>
|
||||
</div><div class="item-left module-item"><a class="struct" href="struct.RedisSession.html" title="actix_redis::RedisSession struct">RedisSession</a></div><div class="item-right docblock-short"><p>Use redis as session storage.</p>
|
||||
</div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="enum" href="enum.Error.html" title="actix_redis::Error enum">Error</a></div><div class="item-right docblock-short"><p>General purpose actix redis error</p>
|
||||
</div><div class="item-left module-item"><a class="enum" href="enum.RespError.html" title="actix_redis::RespError enum">RespError</a></div><div class="item-right docblock-short"></div><div class="item-left module-item"><a class="enum" href="enum.RespValue.html" title="actix_redis::RespValue enum">RespValue</a></div><div class="item-right docblock-short"><p>A single RESP value, this owns the data that is read/to-be written to Redis.</p>
|
||||
</div><div class="item-left module-item"><a class="enum" href="enum.SameSite.html" title="actix_redis::SameSite enum">SameSite</a></div><div class="item-right docblock-short"><p>The <code>SameSite</code> cookie attribute.</p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_redis" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Command.html" title="actix_redis::Command struct">Command</a></div><div class="item-right docblock-short"><p>Command for send data to Redis</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.RedisActor.html" title="actix_redis::RedisActor struct">RedisActor</a></div><div class="item-right docblock-short"><p>Redis communication actor</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.RedisSession.html" title="actix_redis::RedisSession struct">RedisSession</a></div><div class="item-right docblock-short"><p>Use redis as session storage.</p>
|
||||
</div></div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Error.html" title="actix_redis::Error enum">Error</a></div><div class="item-right docblock-short"><p>General purpose actix redis error</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.RespError.html" title="actix_redis::RespError enum">RespError</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.RespValue.html" title="actix_redis::RespValue enum">RespValue</a></div><div class="item-right docblock-short"><p>A single RESP value, this owns the data that is read/to-be written to Redis.</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.SameSite.html" title="actix_redis::SameSite enum">SameSite</a></div><div class="item-right docblock-short"><p>The <code>SameSite</code> cookie attribute.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_redis" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
@ -1,4 +1,4 @@
|
||||
<!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="Command for send data to Redis"><meta name="keywords" content="rust, rustlang, rust-lang, Command"><title>Command in actix_redis - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_redis/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Struct Command</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#fields">Tuple Fields</a></h3><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Handler%3CCommand%3E">Handler<Command></a><a href="#impl-Message">Message</a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Instrument">Instrument</a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-Same%3CT%3E">Same<T></a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a></div></div><h2 class="location">Other items in<br><a href="index.html">actix_redis</a></h2><div id="sidebar-vars" data-name="Command" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="index.html">actix_redis</a>::<wbr><a class="struct" href="#">Command</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_redis/redis.rs.html#21" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust struct"><code>pub struct Command(pub <a class="enum" href="enum.RespValue.html" title="enum actix_redis::RespValue">RespValue</a>);</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Command for send data to Redis</p>
|
||||
<!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="Command for send data to Redis"><meta name="keywords" content="rust, rustlang, rust-lang, Command"><title>Command in actix_redis - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_redis/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Struct Command</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#fields">Tuple Fields</a></h3><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-Debug">Debug</a><a href="#impl-Handler%3CCommand%3E">Handler<Command></a><a href="#impl-Message">Message</a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Instrument">Instrument</a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-Same%3CT%3E">Same<T></a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a><a href="#impl-WithSubscriber">WithSubscriber</a></div></div><h2 class="location">Other items in<br><a href="index.html">actix_redis</a></h2><div id="sidebar-vars" data-name="Command" data-ty="struct" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Struct <a href="index.html">actix_redis</a>::<wbr><a class="struct" href="#">Command</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_redis/redis.rs.html#21" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust struct"><code>pub struct Command(pub <a class="enum" href="enum.RespValue.html" title="enum actix_redis::RespValue">RespValue</a>);</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Command for send data to Redis</p>
|
||||
</div></details><h2 id="fields" class="fields small-section-header">Tuple Fields<a href="#fields" class="anchor"></a></h2><span id="structfield.0" class="structfield small-section-header"><a href="#structfield.0" class="anchor field"></a><code>0: <a class="enum" href="enum.RespValue.html" title="enum actix_redis::RespValue">RespValue</a></code></span><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Debug" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/redis.rs.html#20" title="goto source code">[src]</a></div><a href="#impl-Debug" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="struct" href="struct.Command.html" title="struct actix_redis::Command">Command</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/redis.rs.html#20" title="goto source code">[src]</a></div><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Handler%3CCommand%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/redis.rs.html#127-141" title="goto source code">[src]</a></div><a href="#impl-Handler%3CCommand%3E" class="anchor"></a><h3 class="code-header in-band">impl Handler<<a class="struct" href="struct.Command.html" title="struct actix_redis::Command">Command</a>> for <a class="struct" href="struct.RedisActor.html" title="struct actix_redis::RedisActor">RedisActor</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Result" class="type trait-impl has-srclink"><a href="#associatedtype.Result" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Result" class="type">Result</a> = ResponseFuture<<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><<a class="enum" href="enum.RespValue.html" title="enum actix_redis::RespValue">RespValue</a>, <a class="enum" href="enum.Error.html" title="enum actix_redis::Error">Error</a>>></h4></div></summary><div class='docblock'><p>The type of value that this handler will return. <a href="#associatedtype.Result">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.handle" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_redis/redis.rs.html#130-140" title="goto source code">[src]</a></div><a href="#method.handle" class="anchor"></a><h4 class="code-header">fn <a class="fnname">handle</a>(&mut self, msg: <a class="struct" href="struct.Command.html" title="struct actix_redis::Command">Command</a>, _: &mut Self::Context) -> Self::Result</h4></div></summary><div class='docblock'><p>This method is called for every message received by this actor.</p>
|
||||
@ -8,16 +8,20 @@ successful. <a href="#associatedtype.Result">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Borrow%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208-213" title="goto source code">[src]</a></div><a href="#impl-Borrow%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#210" title="goto source code">[src]</a></div><a href="#method.borrow" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</h4></div></summary><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-BorrowMut%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#216-220" title="goto source code">[src]</a></div><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow_mut" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217" title="goto source code">[src]</a></div><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</h4></div></summary><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546-550" title="goto source code">[src]</a></div><a href="#impl-From%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#547" title="goto source code">[src]</a></div><a href="#method.from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Instrument" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#155" title="goto source code">[src]</a></div><a href="#impl-Instrument" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.instrument" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#38" title="goto source code">[src]</a></div><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -> <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the provided <code>Span</code>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.in_current_span" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#74" title="goto source code">[src]</a></div><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the <a href="../struct.Span.html#method.current">current</a> <code>Span</code>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Instrument" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#276" title="goto source code">[src]</a></div><a href="#impl-Instrument" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.instrument" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#82" title="goto source code">[src]</a></div><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the provided <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html" title="Span"><code>Span</code></a>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.in_current_span" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#121" title="goto source code">[src]</a></div><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html#method.current">current</a> <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html"><code>Span</code></a>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Into%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#535-542" title="goto source code">[src]</a></div><a href="#impl-Into%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#539" title="goto source code">[src]</a></div><a href="#method.into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Same%3CT%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Same%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> Same<T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Output" class="type trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Output" class="type">Output</a> = T</h4></div></summary><div class='docblock'><p>Should always be <code>Self</code></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Same%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/typenum/1.14.0/src/typenum/type_operators.rs.html#34-36" title="goto source code">[src]</a></div><a href="#impl-Same%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/typenum/1.14.0/typenum/type_operators/trait.Same.html" title="trait typenum::type_operators::Same">Same</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Output" class="type trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a href="https://docs.rs/typenum/1.14.0/typenum/type_operators/trait.Same.html#associatedtype.Output" class="type">Output</a> = T</h4></div></summary><div class='docblock'><p>Should always be <code>Self</code></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryFrom%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#583-592" title="goto source code">[src]</a></div><a href="#impl-TryFrom%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error" class="type trait-impl has-srclink"><a href="#associatedtype.Error" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" class="type">Error</a> = <a class="enum" href="https://doc.rust-lang.org/nightly/core/convert/enum.Infallible.html" title="enum core::convert::Infallible">Infallible</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#589" title="goto source code">[src]</a></div><a href="#method.try_from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryInto%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#569-578" title="goto source code">[src]</a></div><a href="#impl-TryInto%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error-1" class="type trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#575" title="goto source code">[src]</a></div><a href="#method.try_into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-VZip%3CV%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-VZip%3CV%3E" class="anchor"></a><h3 class="code-header in-band">impl<V, T> VZip<V> for T <span class="where fmt-newline">where<br> V: MultiLane<T>, </span></h3></div></summary><div class="impl-items"><div id="method.vzip" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.vzip" class="anchor"></a><h4 class="code-header">pub fn <a class="fnname">vzip</a>(self) -> V</h4></div></div></details></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_redis" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-VZip%3CV%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-VZip%3CV%3E" class="anchor"></a><h3 class="code-header in-band">impl<V, T> VZip<V> for T <span class="where fmt-newline">where<br> V: MultiLane<T>, </span></h3></div></summary><div class="impl-items"><div id="method.vzip" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.vzip" class="anchor"></a><h4 class="code-header">pub fn <a class="fnname">vzip</a>(self) -> V</h4></div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-WithSubscriber" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#334" title="goto source code">[src]</a></div><a href="#impl-WithSubscriber" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html" title="trait tracing::instrument::WithSubscriber">WithSubscriber</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_subscriber" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#169-171" title="goto source code">[src]</a></div><a href="#method.with_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber" class="fnname">with_subscriber</a><S>(self, subscriber: S) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self> <span class="where fmt-newline">where<br> S: <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="https://docs.rs/tracing-core/0.1.21/tracing_core/dispatcher/struct.Dispatch.html" title="struct tracing_core::dispatcher::Dispatch">Dispatch</a>>, </span></h4></div></summary><div class='docblock'><p>Attaches the provided <a href="https://docs.rs/tracing-core/0.1.21/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
|
||||
<a href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_current_subscriber" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#221" title="goto source code">[src]</a></div><a href="#method.with_current_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber" class="fnname">with_current_subscriber</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self></h4></div></summary><div class='docblock'><p>Attaches the current <a href="https://docs.rs/tracing/0.1.29/tracing/dispatcher/index.html#setting-the-default-subscriber">default</a> <a href="https://docs.rs/tracing-core/0.1.21/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
|
||||
<a href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber">Read more</a></p>
|
||||
</div></details></div></details></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_redis" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
<!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="Status of a [`Session`]."><meta name="keywords" content="rust, rustlang, rust-lang, SessionStatus"><title>SessionStatus in actix_session - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc enum"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_session/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Enum SessionStatus</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#variants">Variants</a></h3><div class="sidebar-links"><a href="#variant.Changed">Changed</a><a href="#variant.Purged">Purged</a><a href="#variant.Renewed">Renewed</a><a href="#variant.Unchanged">Unchanged</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Default">Default</a><a href="#impl-PartialEq%3CSessionStatus%3E">PartialEq<SessionStatus></a><a href="#impl-StructuralPartialEq">StructuralPartialEq</a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Instrument">Instrument</a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-Same%3CT%3E">Same<T></a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a></div></div><h2 class="location">Other items in<br><a href="index.html">actix_session</a></h2><div id="sidebar-vars" data-name="SessionStatus" data-ty="enum" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Enum <a href="index.html">actix_session</a>::<wbr><a class="enum" href="#">SessionStatus</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_session/lib.rs.html#112-133" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust enum"><code>pub enum SessionStatus {
|
||||
<!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="Status of a [`Session`]."><meta name="keywords" content="rust, rustlang, rust-lang, SessionStatus"><title>SessionStatus in actix_session - 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="../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../ayu.css" disabled ><script id="default-settings" ></script><script src="../storage.js"></script><script src="../crates.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../favicon.svg"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc enum"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../actix_session/index.html'><div class='logo-container rust-logo'><img src='../rust-logo.png' alt='logo'></div></a><h2 class="location">Enum SessionStatus</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#variants">Variants</a></h3><div class="sidebar-links"><a href="#variant.Changed">Changed</a><a href="#variant.Purged">Purged</a><a href="#variant.Renewed">Renewed</a><a href="#variant.Unchanged">Unchanged</a></div><h3 class="sidebar-title"><a href="#trait-implementations">Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a><a href="#impl-Default">Default</a><a href="#impl-PartialEq%3CSessionStatus%3E">PartialEq<SessionStatus></a><a href="#impl-StructuralPartialEq">StructuralPartialEq</a></div><h3 class="sidebar-title"><a href="#synthetic-implementations">Auto Trait Implementations</a></h3><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><h3 class="sidebar-title"><a href="#blanket-implementations">Blanket Implementations</a></h3><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow<T></a><a href="#impl-BorrowMut%3CT%3E">BorrowMut<T></a><a href="#impl-From%3CT%3E">From<T></a><a href="#impl-Instrument">Instrument</a><a href="#impl-Into%3CU%3E">Into<U></a><a href="#impl-Same%3CT%3E">Same<T></a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom<U></a><a href="#impl-TryInto%3CU%3E">TryInto<U></a><a href="#impl-VZip%3CV%3E">VZip<V></a><a href="#impl-WithSubscriber">WithSubscriber</a></div></div><h2 class="location">Other items in<br><a href="index.html">actix_session</a></h2><div id="sidebar-vars" data-name="SessionStatus" data-ty="enum" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Enum <a href="index.html">actix_session</a>::<wbr><a class="enum" href="#">SessionStatus</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_session/lib.rs.html#112-133" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust enum"><code>pub enum SessionStatus {
|
||||
Changed,
|
||||
Purged,
|
||||
Renewed,
|
||||
@ -15,22 +15,22 @@ be notified of the refresh.</p>
|
||||
<p>This state also captures new (previously unissued) sessions such as a user’s first
|
||||
site visit.</p>
|
||||
</div><h2 id="trait-implementations" class="small-section-header">Trait Implementations<a href="#trait-implementations" class="anchor"></a></h2><div id="trait-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Clone" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#111" title="goto source code">[src]</a></div><a href="#impl-Clone" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.clone" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#111" title="goto source code">[src]</a></div><a href="#method.clone" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone" class="fnname">clone</a>(&self) -> <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h4></div></summary><div class='docblock'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.clone_from" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#130" title="goto source code">[src]</a></div><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</h4></div></summary><div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.clone_from" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/clone.rs.html#131" title="goto source code">[src]</a></div><a href="#method.clone_from" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from" class="fnname">clone_from</a>(&mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Self)</h4></div></summary><div class='docblock'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Debug" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#111" title="goto source code">[src]</a></div><a href="#impl-Debug" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fmt" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#111" title="goto source code">[src]</a></div><a href="#method.fmt" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt" class="fnname">fmt</a>(&self, f: &mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a><'_>) -> <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></h4></div></summary><div class='docblock'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Default" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#135-139" title="goto source code">[src]</a></div><a href="#impl-Default" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html" title="trait core::default::Default">Default</a> for <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.default" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#136-138" title="goto source code">[src]</a></div><a href="#method.default" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default" class="fnname">default</a>() -> <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h4></div></summary><div class='docblock'><p>Returns the “default value” for a type. <a href="https://doc.rust-lang.org/nightly/core/default/trait.Default.html#tymethod.default">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-PartialEq%3CSessionStatus%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#111" title="goto source code">[src]</a></div><a href="#impl-PartialEq%3CSessionStatus%3E" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html" title="trait core::cmp::PartialEq">PartialEq</a><<a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a>> for <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.eq" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#111" title="goto source code">[src]</a></div><a href="#method.eq" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq" class="fnname">eq</a>(&self, other: &<a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a>) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></div></summary><div class='docblock'><p>This method tests for <code>self</code> and <code>other</code> values to be equal, and is used
|
||||
by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#tymethod.eq">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.ne" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#217" title="goto source code">[src]</a></div><a href="#method.ne" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fnname">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></div></summary><div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.ne" class="method trait-impl has-srclink"><div class="rightside"><span class="since" title="Stable since Rust version 1.0.0">1.0.0</span><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/cmp.rs.html#218" title="goto source code">[src]</a></div><a href="#method.ne" class="anchor"></a><h4 class="code-header">fn <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.PartialEq.html#method.ne" class="fnname">ne</a>(&self, other: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>Rhs) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a></h4></div></summary><div class='docblock'><p>This method tests for <code>!=</code>.</p>
|
||||
</div></details></div></details><div id="impl-StructuralPartialEq" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#111" title="goto source code">[src]</a></div><a href="#impl-StructuralPartialEq" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.StructuralPartialEq.html" title="trait core::marker::StructuralPartialEq">StructuralPartialEq</a> for <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h3></div></div><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><div id="impl-RefUnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-RefUnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h3></div><div id="impl-Send" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Send" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h3></div><div id="impl-Sync" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Sync" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h3></div><div id="impl-Unpin" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Unpin" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h3></div><div id="impl-UnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-UnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="enum" href="enum.SessionStatus.html" title="enum actix_session::SessionStatus">SessionStatus</a></h3></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Any" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132-136" title="goto source code">[src]</a></div><a href="#impl-Any" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.type_id" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#133" title="goto source code">[src]</a></div><a href="#method.type_id" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></div></summary><div class='docblock'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Borrow%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#208-213" title="goto source code">[src]</a></div><a href="#impl-Borrow%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#210" title="goto source code">[src]</a></div><a href="#method.borrow" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&</a>T</h4></div></summary><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-BorrowMut%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#216-220" title="goto source code">[src]</a></div><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow_mut" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#217" title="goto source code">[src]</a></div><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T</h4></div></summary><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#546-550" title="goto source code">[src]</a></div><a href="#impl-From%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#547" title="goto source code">[src]</a></div><a href="#method.from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Instrument" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#155" title="goto source code">[src]</a></div><a href="#impl-Instrument" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.instrument" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#38" title="goto source code">[src]</a></div><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -> <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the provided <code>Span</code>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.in_current_span" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.26/src/tracing/instrument.rs.html#74" title="goto source code">[src]</a></div><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.26/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the <a href="../struct.Span.html#method.current">current</a> <code>Span</code>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.26/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Instrument" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#276" title="goto source code">[src]</a></div><a href="#impl-Instrument" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html" title="trait tracing::instrument::Instrument">Instrument</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.instrument" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#82" title="goto source code">[src]</a></div><a href="#method.instrument" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.instrument" class="fnname">instrument</a>(self, span: <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html" title="struct tracing::span::Span">Span</a>) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the provided <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html" title="Span"><code>Span</code></a>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.instrument">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.in_current_span" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#121" title="goto source code">[src]</a></div><a href="#method.in_current_span" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.in_current_span" class="fnname">in_current_span</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.Instrumented.html" title="struct tracing::instrument::Instrumented">Instrumented</a><Self></h4></div></summary><div class='docblock'><p>Instruments this type with the <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html#method.current">current</a> <a href="https://docs.rs/tracing/0.1.29/tracing/span/struct.Span.html"><code>Span</code></a>, returning an
|
||||
<code>Instrumented</code> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.Instrument.html#method.in_current_span">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Into%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#535-542" title="goto source code">[src]</a></div><a href="#impl-Into%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#539" title="goto source code">[src]</a></div><a href="#method.into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html#tymethod.into" class="fnname">into</a>(self) -> U</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Same%3CT%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Same%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> Same<T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Output" class="type trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Output" class="type">Output</a> = T</h4></div></summary><div class='docblock'><p>Should always be <code>Self</code></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Same%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/typenum/1.14.0/src/typenum/type_operators.rs.html#34-36" title="goto source code">[src]</a></div><a href="#impl-Same%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/typenum/1.14.0/typenum/type_operators/trait.Same.html" title="trait typenum::type_operators::Same">Same</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Output" class="type trait-impl has-srclink"><a href="#associatedtype.Output" class="anchor"></a><h4 class="code-header">type <a href="https://docs.rs/typenum/1.14.0/typenum/type_operators/trait.Same.html#associatedtype.Output" class="type">Output</a> = T</h4></div></summary><div class='docblock'><p>Should always be <code>Self</code></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-ToOwned" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#84-96" title="goto source code">[src]</a></div><a href="#impl-ToOwned" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html" title="trait alloc::borrow::ToOwned">ToOwned</a> for T <span class="where fmt-newline">where<br> T: <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Owned" class="type trait-impl has-srclink"><a href="#associatedtype.Owned" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#associatedtype.Owned" class="type">Owned</a> = T</h4></div></summary><div class='docblock'><p>The resulting type after obtaining ownership.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.to_owned" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#89" title="goto source code">[src]</a></div><a href="#method.to_owned" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned" class="fnname">to_owned</a>(&self) -> T</h4></div></summary><div class='docblock'><p>Creates owned data from borrowed data, usually by cloning. <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#tymethod.to_owned">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.clone_into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/alloc/borrow.rs.html#93" title="goto source code">[src]</a></div><a href="#method.clone_into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/alloc/borrow/trait.ToOwned.html#method.clone_into" class="fnname">clone_into</a>(&self, target: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&mut </a>T)</h4></div></summary><div class="item-info"><div class="stab unstable"><details><summary><span class="emoji">🔬</span> This is a nightly-only experimental API. (<code>toowned_clone_into</code>)</summary><p>recently added</p>
|
||||
@ -39,6 +39,10 @@ by <code>==</code>. <a href="https://doc.rust-lang.org/nightly/core/cmp/trait.Pa
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#589" title="goto source code">[src]</a></div><a href="#method.try_from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#tymethod.try_from" class="fnname">try_from</a>(value: U) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><T, <T as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><U>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-TryInto%3CU%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#569-578" title="goto source code">[src]</a></div><a href="#impl-TryInto%3CU%3E" class="anchor"></a><h3 class="code-header in-band">impl<T, U> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html" title="trait core::convert::TryInto">TryInto</a><U> for T <span class="where fmt-newline">where<br> U: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error-1" class="type trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#associatedtype.Error" class="type">Error</a> = <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a></h4></div></summary><div class='docblock'><p>The type returned in the event of a conversion error.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.try_into" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#575" title="goto source code">[src]</a></div><a href="#method.try_into" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.TryInto.html#tymethod.try_into" class="fnname">try_into</a>(self) -> <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><U, <U as <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html" title="trait core::convert::TryFrom">TryFrom</a><T>>::<a class="type" href="https://doc.rust-lang.org/nightly/core/convert/trait.TryFrom.html#associatedtype.Error" title="type core::convert::TryFrom::Error">Error</a>></h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-VZip%3CV%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-VZip%3CV%3E" class="anchor"></a><h3 class="code-header in-band">impl<V, T> VZip<V> for T <span class="where fmt-newline">where<br> V: MultiLane<T>, </span></h3></div></summary><div class="impl-items"><div id="method.vzip" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.vzip" class="anchor"></a><h4 class="code-header">pub fn <a class="fnname">vzip</a>(self) -> V</h4></div></div></details></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_session" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-VZip%3CV%3E" class="impl has-srclink"><div class="rightside"></div><a href="#impl-VZip%3CV%3E" class="anchor"></a><h3 class="code-header in-band">impl<V, T> VZip<V> for T <span class="where fmt-newline">where<br> V: MultiLane<T>, </span></h3></div></summary><div class="impl-items"><div id="method.vzip" class="method trait-impl has-srclink"><div class="rightside"></div><a href="#method.vzip" class="anchor"></a><h4 class="code-header">pub fn <a class="fnname">vzip</a>(self) -> V</h4></div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-WithSubscriber" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#334" title="goto source code">[src]</a></div><a href="#impl-WithSubscriber" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html" title="trait tracing::instrument::WithSubscriber">WithSubscriber</a> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_subscriber" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#169-171" title="goto source code">[src]</a></div><a href="#method.with_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber" class="fnname">with_subscriber</a><S>(self, subscriber: S) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self> <span class="where fmt-newline">where<br> S: <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="https://docs.rs/tracing-core/0.1.21/tracing_core/dispatcher/struct.Dispatch.html" title="struct tracing_core::dispatcher::Dispatch">Dispatch</a>>, </span></h4></div></summary><div class='docblock'><p>Attaches the provided <a href="https://docs.rs/tracing-core/0.1.21/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
|
||||
<a href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_subscriber">Read more</a></p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.with_current_subscriber" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://docs.rs/tracing/0.1.29/src/tracing/instrument.rs.html#221" title="goto source code">[src]</a></div><a href="#method.with_current_subscriber" class="anchor"></a><h4 class="code-header">fn <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber" class="fnname">with_current_subscriber</a>(self) -> <a class="struct" href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="struct tracing::instrument::WithDispatch">WithDispatch</a><Self></h4></div></summary><div class='docblock'><p>Attaches the current <a href="https://docs.rs/tracing/0.1.29/tracing/dispatcher/index.html#setting-the-default-subscriber">default</a> <a href="https://docs.rs/tracing-core/0.1.21/tracing_core/subscriber/trait.Subscriber.html"><code>Subscriber</code></a> to this type, returning a
|
||||
<a href="https://docs.rs/tracing/0.1.29/tracing/instrument/struct.WithDispatch.html" title="WithDispatch"><code>WithDispatch</code></a> wrapper. <a href="https://docs.rs/tracing/0.1.29/tracing/instrument/trait.WithSubscriber.html#method.with_current_subscriber">Read more</a></p>
|
||||
</div></details></div></details></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_session" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
@ -10,7 +10,7 @@ modifying session data.</p>
|
||||
<div class="example-wrap"><pre class="rust rust-example-rendered"><code><span class="kw">use</span> <span class="ident">actix_web</span>::{<span class="ident">web</span>, <span class="ident">App</span>, <span class="ident">HttpServer</span>, <span class="ident">HttpResponse</span>, <span class="ident">Error</span>};
|
||||
<span class="kw">use</span> <span class="ident">actix_session</span>::{<span class="ident">Session</span>, <span class="ident">CookieSession</span>};
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">session</span>: <span class="ident">Session</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="kw-2">&</span><span class="lifetime">'static</span> <span class="ident">str</span>, <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">session</span>: <span class="ident">Session</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="kw-2">&</span><span class="lifetime">'static</span> <span class="ident">str</span>, <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="comment">// access session data</span>
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">count</span>) <span class="op">=</span> <span class="ident">session</span>.<span class="ident">get</span>::<span class="op"><</span><span class="ident">i32</span><span class="op">></span>(<span class="string">"counter"</span>)<span class="question-mark">?</span> {
|
||||
<span class="macro">println!</span>(<span class="string">"SESSION value: {}"</span>, <span class="ident">count</span>);
|
||||
@ -23,7 +23,7 @@ modifying session data.</p>
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">actix_rt::main</span>]</span>
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">main</span>() <span class="op">-</span><span class="op">></span> <span class="ident">std::io::Result</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">main</span>() -> <span class="ident">std::io::Result</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="ident">HttpServer::new</span>(
|
||||
<span class="op">|</span><span class="op">|</span> <span class="ident">App::new</span>()
|
||||
<span class="comment">// create cookie based session middleware</span>
|
||||
@ -34,12 +34,12 @@ modifying session data.</p>
|
||||
.<span class="kw">await</span>
|
||||
}</code></pre></div>
|
||||
</div></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.CookieSession.html" title="actix_session::CookieSession struct">CookieSession</a></div><div class="item-right docblock-short"><p>Use cookies for session storage.</p>
|
||||
</div><div class="item-left module-item"><a class="struct" href="struct.Session.html" title="actix_session::Session struct">Session</a></div><div class="item-right docblock-short"><p>The high-level interface you use to modify session data.</p>
|
||||
</div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="enum" href="enum.SessionStatus.html" title="actix_session::SessionStatus enum">SessionStatus</a></div><div class="item-right docblock-short"><p>Status of a <a href="struct.Session.html" title="Session"><code>Session</code></a>.</p>
|
||||
</div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="trait" href="trait.UserSession.html" title="actix_session::UserSession trait">UserSession</a></div><div class="item-right docblock-short"><p>Extraction of a <a href="struct.Session.html" title="Session"><code>Session</code></a> object.</p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_session" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.CookieSession.html" title="actix_session::CookieSession struct">CookieSession</a></div><div class="item-right docblock-short"><p>Use cookies for session storage.</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Session.html" title="actix_session::Session struct">Session</a></div><div class="item-right docblock-short"><p>The high-level interface you use to modify session data.</p>
|
||||
</div></div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.SessionStatus.html" title="actix_session::SessionStatus enum">SessionStatus</a></div><div class="item-right docblock-short"><p>Status of a <a href="struct.Session.html" title="Session"><code>Session</code></a>.</p>
|
||||
</div></div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.UserSession.html" title="actix_session::UserSession trait">UserSession</a></div><div class="item-right docblock-short"><p>Extraction of a <a href="struct.Session.html" title="Session"><code>Session</code></a> object.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_session" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2,6 +2,6 @@
|
||||
fn <a href="#tymethod.get_session" class="fnname">get_session</a>(&self) -> <a class="struct" href="struct.Session.html" title="struct actix_session::Session">Session</a>;
|
||||
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extraction of a <a href="struct.Session.html" title="Session"><code>Session</code></a> object.</p>
|
||||
</div></details><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.get_session" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#89" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.get_session" class="fnname">get_session</a>(&self) -> <a class="struct" href="struct.Session.html" title="struct actix_session::Session">Session</a></h4></div></summary><div class="docblock"><p>Extract the <a href="struct.Session.html" title="Session"><code>Session</code></a> object</p>
|
||||
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-UserSession-for-HttpRequest" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#92-96" title="goto source code">[src]</a></div><a href="#impl-UserSession-for-HttpRequest" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.UserSession.html" title="trait actix_session::UserSession">UserSession</a> for HttpRequest</h3></div></summary><div class="impl-items"><div id="method.get_session" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#93-95" title="goto source code">[src]</a></div><a href="#method.get_session" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.get_session" class="fnname">get_session</a>(&self) -> <a class="struct" href="struct.Session.html" title="struct actix_session::Session">Session</a></h4></div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-UserSession-for-ServiceRequest" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#98-102" title="goto source code">[src]</a></div><a href="#impl-UserSession-for-ServiceRequest" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.UserSession.html" title="trait actix_session::UserSession">UserSession</a> for ServiceRequest</h3></div></summary><div class="impl-items"><div id="method.get_session-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#99-101" title="goto source code">[src]</a></div><a href="#method.get_session-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.get_session" class="fnname">get_session</a>(&self) -> <a class="struct" href="struct.Session.html" title="struct actix_session::Session">Session</a></h4></div></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-UserSession-for-RequestHead" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#104-108" title="goto source code">[src]</a></div><a href="#impl-UserSession-for-RequestHead" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.UserSession.html" title="trait actix_session::UserSession">UserSession</a> for RequestHead</h3></div></summary><div class="impl-items"><div id="method.get_session-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#105-107" title="goto source code">[src]</a></div><a href="#method.get_session-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.get_session" class="fnname">get_session</a>(&self) -> <a class="struct" href="struct.Session.html" title="struct actix_session::Session">Session</a></h4></div></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/actix_session/trait.UserSession.js" async></script></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_session" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-UserSession-for-HttpRequest" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#92-96" title="goto source code">[src]</a></div><a href="#impl-UserSession-for-HttpRequest" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.UserSession.html" title="trait actix_session::UserSession">UserSession</a> for HttpRequest</h3></div></summary><div class="impl-items"><div id="method.get_session" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#93-95" title="goto source code">[src]</a></div><a href="#method.get_session" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.get_session" class="fnname">get_session</a>(&self) -> <a class="struct" href="struct.Session.html" title="struct actix_session::Session">Session</a></h4></div></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-UserSession-for-ServiceRequest" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#98-102" title="goto source code">[src]</a></div><a href="#impl-UserSession-for-ServiceRequest" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.UserSession.html" title="trait actix_session::UserSession">UserSession</a> for ServiceRequest</h3></div></summary><div class="impl-items"><div id="method.get_session-1" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#99-101" title="goto source code">[src]</a></div><a href="#method.get_session-1" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.get_session" class="fnname">get_session</a>(&self) -> <a class="struct" href="struct.Session.html" title="struct actix_session::Session">Session</a></h4></div></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-UserSession-for-RequestHead" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#104-108" title="goto source code">[src]</a></div><a href="#impl-UserSession-for-RequestHead" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.UserSession.html" title="trait actix_session::UserSession">UserSession</a> for RequestHead</h3></div></summary><div class="impl-items"><div id="method.get_session-2" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_session/lib.rs.html#105-107" title="goto source code">[src]</a></div><a href="#method.get_session-2" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.get_session" class="fnname">get_session</a>(&self) -> <a class="struct" href="struct.Session.html" title="struct actix_session::Session">Session</a></h4></div></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/actix_session/trait.UserSession.js" async></script></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_session" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
@ -1,8 +1,8 @@
|
||||
<!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="Extractor for the “Basic” HTTP Authentication Scheme"><meta name="keywords" content="rust, rustlang, rust-lang, basic"><title>actix_web_httpauth::extractors::basic - 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="../../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../../ayu.css" disabled ><script id="default-settings" ></script><script src="../../../storage.js"></script><script src="../../../crates.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../../../actix_web_httpauth/index.html'><div class='logo-container rust-logo'><img src='../../../rust-logo.png' alt='logo'></div></a><h2 class="location">Module basic</h2><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><div id="sidebar-vars" data-name="basic" data-ty="mod" data-relpath="./"></div><script defer src="./sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../../index.html">actix_web_httpauth</a>::<wbr><a href="../index.html">extractors</a>::<wbr><a class="mod" href="#">basic</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_httpauth/extractors/basic.rs.html#1-149" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extractor for the “Basic” HTTP Authentication Scheme</p>
|
||||
</div></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.BasicAuth.html" title="actix_web_httpauth::extractors::basic::BasicAuth struct">BasicAuth</a></div><div class="item-right docblock-short"><p>Extractor for HTTP Basic auth.</p>
|
||||
</div><div class="item-left module-item"><a class="struct" href="struct.Config.html" title="actix_web_httpauth::extractors::basic::Config struct">Config</a></div><div class="item-right docblock-short"><p><a href="./struct.BasicAuth.html"><code>BasicAuth</code></a> extractor configuration,
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.BasicAuth.html" title="actix_web_httpauth::extractors::basic::BasicAuth struct">BasicAuth</a></div><div class="item-right docblock-short"><p>Extractor for HTTP Basic auth.</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Config.html" title="actix_web_httpauth::extractors::basic::Config struct">Config</a></div><div class="item-right docblock-short"><p><a href="./struct.BasicAuth.html"><code>BasicAuth</code></a> extractor configuration,
|
||||
used for <a href="../../headers/www_authenticate/struct.WwwAuthenticate.html"><code>WWW-Authenticate</code></a> header later.</p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../search-index.js" data-search-js="../../../search.js"></div>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../search-index.js" data-search-js="../../../search.js"></div>
|
||||
<script src="../../../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,9 +1,9 @@
|
||||
<!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="Extractor for the “Bearer” HTTP Authentication Scheme"><meta name="keywords" content="rust, rustlang, rust-lang, bearer"><title>actix_web_httpauth::extractors::bearer - 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="../../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../../ayu.css" disabled ><script id="default-settings" ></script><script src="../../../storage.js"></script><script src="../../../crates.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../../../actix_web_httpauth/index.html'><div class='logo-container rust-logo'><img src='../../../rust-logo.png' alt='logo'></div></a><h2 class="location">Module bearer</h2><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li></ul></div><div id="sidebar-vars" data-name="bearer" data-ty="mod" data-relpath="./"></div><script defer src="./sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../../index.html">actix_web_httpauth</a>::<wbr><a href="../index.html">extractors</a>::<wbr><a class="mod" href="#">bearer</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_httpauth/extractors/bearer.rs.html#1-177" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extractor for the “Bearer” HTTP Authentication Scheme</p>
|
||||
</div></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.BearerAuth.html" title="actix_web_httpauth::extractors::bearer::BearerAuth struct">BearerAuth</a></div><div class="item-right docblock-short"><p>Extractor for HTTP Bearer auth</p>
|
||||
</div><div class="item-left module-item"><a class="struct" href="struct.Config.html" title="actix_web_httpauth::extractors::bearer::Config struct">Config</a></div><div class="item-right docblock-short"><p><a href="./struct/BearerAuth.html">BearerAuth</a> extractor configuration.</p>
|
||||
</div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="enum" href="enum.Error.html" title="actix_web_httpauth::extractors::bearer::Error enum">Error</a></div><div class="item-right docblock-short"><p>Bearer authorization error types, described in <a href="https://tools.ietf.org/html/rfc6750#section-3.1">RFC 6750</a></p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../search-index.js" data-search-js="../../../search.js"></div>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.BearerAuth.html" title="actix_web_httpauth::extractors::bearer::BearerAuth struct">BearerAuth</a></div><div class="item-right docblock-short"><p>Extractor for HTTP Bearer auth</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Config.html" title="actix_web_httpauth::extractors::bearer::Config struct">Config</a></div><div class="item-right docblock-short"><p><a href="./struct/BearerAuth.html">BearerAuth</a> extractor configuration.</p>
|
||||
</div></div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Error.html" title="actix_web_httpauth::extractors::bearer::Error enum">Error</a></div><div class="item-right docblock-short"><p>Bearer authorization error types, described in <a href="https://tools.ietf.org/html/rfc6750#section-3.1">RFC 6750</a></p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../search-index.js" data-search-js="../../../search.js"></div>
|
||||
<script src="../../../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,14 +1,14 @@
|
||||
<!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="Type-safe authentication information extractors"><meta name="keywords" content="rust, rustlang, rust-lang, extractors"><title>actix_web_httpauth::extractors - 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="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings" ></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../../actix_web_httpauth/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><h2 class="location">Module extractors</h2><div class="sidebar-elems"><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></div><div id="sidebar-vars" data-name="extractors" data-ty="mod" data-relpath="./"></div><script defer src="./sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">actix_web_httpauth</a>::<wbr><a class="mod" href="#">extractors</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_httpauth/extractors/mod.rs.html#1-33" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Type-safe authentication information extractors</p>
|
||||
</div></details><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="mod" href="basic/index.html" title="actix_web_httpauth::extractors::basic mod">basic</a></div><div class="item-right docblock-short"><p>Extractor for the “Basic” HTTP Authentication Scheme</p>
|
||||
</div><div class="item-left module-item"><a class="mod" href="bearer/index.html" title="actix_web_httpauth::extractors::bearer mod">bearer</a></div><div class="item-right docblock-short"><p>Extractor for the “Bearer” HTTP Authentication Scheme</p>
|
||||
</div></div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.AuthenticationError.html" title="actix_web_httpauth::extractors::AuthenticationError struct">AuthenticationError</a></div><div class="item-right docblock-short"><p>Authentication error returned by authentication extractors.</p>
|
||||
</div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="trait" href="trait.AuthExtractor.html" title="actix_web_httpauth::extractors::AuthExtractor trait">AuthExtractor</a></div><div class="item-right docblock-short"><p>Trait implemented by types that can extract
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="basic/index.html" title="actix_web_httpauth::extractors::basic mod">basic</a></div><div class="item-right docblock-short"><p>Extractor for the “Basic” HTTP Authentication Scheme</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="bearer/index.html" title="actix_web_httpauth::extractors::bearer mod">bearer</a></div><div class="item-right docblock-short"><p>Extractor for the “Bearer” HTTP Authentication Scheme</p>
|
||||
</div></div></div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.AuthenticationError.html" title="actix_web_httpauth::extractors::AuthenticationError struct">AuthenticationError</a></div><div class="item-right docblock-short"><p>Authentication error returned by authentication extractors.</p>
|
||||
</div></div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.AuthExtractor.html" title="actix_web_httpauth::extractors::AuthExtractor trait">AuthExtractor</a></div><div class="item-right docblock-short"><p>Trait implemented by types that can extract
|
||||
HTTP authentication scheme credentials from the request.</p>
|
||||
</div><div class="item-left module-item"><a class="trait" href="trait.AuthExtractorConfig.html" title="actix_web_httpauth::extractors::AuthExtractorConfig trait">AuthExtractorConfig</a></div><div class="item-right docblock-short"><p>Trait implemented for types that provides configuration
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.AuthExtractorConfig.html" title="actix_web_httpauth::extractors::AuthExtractorConfig trait">AuthExtractorConfig</a></div><div class="item-right docblock-short"><p>Trait implemented for types that provides configuration
|
||||
for the authentication <a href="./trait.AuthExtractor.html">extractors</a>.</p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
<script src="../../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
@ -12,6 +12,6 @@ authentication scheme.</p>
|
||||
</div></details><h2 id="associated-types" class="small-section-header">Associated Types<a href="#associated-types" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Error" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/mod.rs.html#26" title="goto source code">[src]</a></div><h4 class="code-header">type <a href="#associatedtype.Error" class="type">Error</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a><Error></h4></div></summary><div class="docblock"><p>The associated error which can be returned.</p>
|
||||
</div></details><details class="rustdoc-toggle" open><summary><div id="associatedtype.Future" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/mod.rs.html#29" title="goto source code">[src]</a></div><h4 class="code-header">type <a href="#associatedtype.Future" class="type">Future</a>: <a class="trait" href="https://doc.rust-lang.org/nightly/core/future/future/trait.Future.html" title="trait core::future::future::Future">Future</a><Output = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, Self::<a class="type" href="trait.AuthExtractor.html#associatedtype.Error" title="type actix_web_httpauth::extractors::AuthExtractor::Error">Error</a>>></h4></div></summary><div class="docblock"><p>Future that resolves into extracted credentials type.</p>
|
||||
</div></details></div><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.from_service_request" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/mod.rs.html#32" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.from_service_request" class="fnname">from_service_request</a>(req: &ServiceRequest) -> Self::<a class="type" href="trait.AuthExtractor.html#associatedtype.Future" title="type actix_web_httpauth::extractors::AuthExtractor::Future">Future</a></h4></div></summary><div class="docblock"><p>Parse the authentication credentials from the actix’ <code>ServiceRequest</code>.</p>
|
||||
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><div id="impl-AuthExtractor" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/basic.rs.html#129-149" title="goto source code">[src]</a></div><a href="#impl-AuthExtractor" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.AuthExtractor.html" title="trait actix_web_httpauth::extractors::AuthExtractor">AuthExtractor</a> for <a class="struct" href="basic/struct.BasicAuth.html" title="struct actix_web_httpauth::extractors::basic::BasicAuth">BasicAuth</a></h3></div><div id="impl-AuthExtractor-1" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/bearer.rs.html#126-144" title="goto source code">[src]</a></div><a href="#impl-AuthExtractor-1" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.AuthExtractor.html" title="trait actix_web_httpauth::extractors::AuthExtractor">AuthExtractor</a> for <a class="struct" href="bearer/struct.BearerAuth.html" title="struct actix_web_httpauth::extractors::bearer::BearerAuth">BearerAuth</a></h3></div></div><script type="text/javascript" src="../../implementors/actix_web_httpauth/extractors/trait.AuthExtractor.js" async></script></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-AuthExtractor" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/basic.rs.html#129-149" title="goto source code">[src]</a></div><a href="#impl-AuthExtractor" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.AuthExtractor.html" title="trait actix_web_httpauth::extractors::AuthExtractor">AuthExtractor</a> for <a class="struct" href="basic/struct.BasicAuth.html" title="struct actix_web_httpauth::extractors::basic::BasicAuth">BasicAuth</a></h3></div></summary><div class="impl-items"><div id="associatedtype.Error-1" class="type trait-impl has-srclink"><a href="#associatedtype.Error-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Error" class="type">Error</a> = <a class="struct" href="struct.AuthenticationError.html" title="struct actix_web_httpauth::extractors::AuthenticationError">AuthenticationError</a><<a class="struct" href="../headers/www_authenticate/basic/struct.Basic.html" title="struct actix_web_httpauth::headers::www_authenticate::basic::Basic">Challenge</a>></h4></div><div id="associatedtype.Future-1" class="type trait-impl has-srclink"><a href="#associatedtype.Future-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Future" class="type">Future</a> = Ready<<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, Self::<a class="type" href="trait.AuthExtractor.html#associatedtype.Error" title="type actix_web_httpauth::extractors::AuthExtractor::Error">Error</a>>></h4></div></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-AuthExtractor-1" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/bearer.rs.html#126-144" title="goto source code">[src]</a></div><a href="#impl-AuthExtractor-1" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.AuthExtractor.html" title="trait actix_web_httpauth::extractors::AuthExtractor">AuthExtractor</a> for <a class="struct" href="bearer/struct.BearerAuth.html" title="struct actix_web_httpauth::extractors::bearer::BearerAuth">BearerAuth</a></h3></div></summary><div class="impl-items"><div id="associatedtype.Future-2" class="type trait-impl has-srclink"><a href="#associatedtype.Future-2" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Future" class="type">Future</a> = Ready<<a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a><Self, Self::<a class="type" href="trait.AuthExtractor.html#associatedtype.Error" title="type actix_web_httpauth::extractors::AuthExtractor::Error">Error</a>>></h4></div><div id="associatedtype.Error-2" class="type trait-impl has-srclink"><a href="#associatedtype.Error-2" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Error" class="type">Error</a> = <a class="struct" href="struct.AuthenticationError.html" title="struct actix_web_httpauth::extractors::AuthenticationError">AuthenticationError</a><<a class="struct" href="../headers/www_authenticate/bearer/struct.Bearer.html" title="struct actix_web_httpauth::headers::www_authenticate::bearer::Bearer">Bearer</a>></h4></div></div></details></div><script type="text/javascript" src="../../implementors/actix_web_httpauth/extractors/trait.AuthExtractor.js" async></script></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
<script src="../../main.js"></script>
|
||||
</body></html>
|
@ -5,6 +5,6 @@
|
||||
for the authentication <a href="./trait.AuthExtractor.html">extractors</a>.</p>
|
||||
</div></details><h2 id="associated-types" class="small-section-header">Associated Types<a href="#associated-types" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="associatedtype.Inner" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/config.rs.html#10" title="goto source code">[src]</a></div><h4 class="code-header">type <a href="#associatedtype.Inner" class="type">Inner</a>: <a class="trait" href="../headers/www_authenticate/trait.Challenge.html" title="trait actix_web_httpauth::headers::www_authenticate::Challenge">Challenge</a></h4></div></summary><div class="docblock"><p>Associated challenge type.</p>
|
||||
</div></details></div><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.into_inner" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/config.rs.html#13" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.into_inner" class="fnname">into_inner</a>(self) -> Self::<a class="type" href="trait.AuthExtractorConfig.html#associatedtype.Inner" title="type actix_web_httpauth::extractors::AuthExtractorConfig::Inner">Inner</a></h4></div></summary><div class="docblock"><p>Convert the config instance into a HTTP challenge.</p>
|
||||
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><div id="impl-AuthExtractorConfig" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/basic.rs.html#45-51" title="goto source code">[src]</a></div><a href="#impl-AuthExtractorConfig" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.AuthExtractorConfig.html" title="trait actix_web_httpauth::extractors::AuthExtractorConfig">AuthExtractorConfig</a> for actix_web_httpauth::extractors::basic::<a class="struct" href="basic/struct.Config.html" title="struct actix_web_httpauth::extractors::basic::Config">Config</a></h3></div><div id="impl-AuthExtractorConfig-1" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/bearer.rs.html#49-55" title="goto source code">[src]</a></div><a href="#impl-AuthExtractorConfig-1" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.AuthExtractorConfig.html" title="trait actix_web_httpauth::extractors::AuthExtractorConfig">AuthExtractorConfig</a> for actix_web_httpauth::extractors::bearer::<a class="struct" href="bearer/struct.Config.html" title="struct actix_web_httpauth::extractors::bearer::Config">Config</a></h3></div></div><script type="text/javascript" src="../../implementors/actix_web_httpauth/extractors/trait.AuthExtractorConfig.js" async></script></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-AuthExtractorConfig" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/basic.rs.html#45-51" title="goto source code">[src]</a></div><a href="#impl-AuthExtractorConfig" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.AuthExtractorConfig.html" title="trait actix_web_httpauth::extractors::AuthExtractorConfig">AuthExtractorConfig</a> for actix_web_httpauth::extractors::basic::<a class="struct" href="basic/struct.Config.html" title="struct actix_web_httpauth::extractors::basic::Config">Config</a></h3></div></summary><div class="impl-items"><div id="associatedtype.Inner-1" class="type trait-impl has-srclink"><a href="#associatedtype.Inner-1" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Inner" class="type">Inner</a> = <a class="struct" href="../headers/www_authenticate/basic/struct.Basic.html" title="struct actix_web_httpauth::headers::www_authenticate::basic::Basic">Challenge</a></h4></div></div></details><details class="rustdoc-toggle implementors-toggle"><summary><div id="impl-AuthExtractorConfig-1" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../src/actix_web_httpauth/extractors/bearer.rs.html#49-55" title="goto source code">[src]</a></div><a href="#impl-AuthExtractorConfig-1" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.AuthExtractorConfig.html" title="trait actix_web_httpauth::extractors::AuthExtractorConfig">AuthExtractorConfig</a> for actix_web_httpauth::extractors::bearer::<a class="struct" href="bearer/struct.Config.html" title="struct actix_web_httpauth::extractors::bearer::Config">Config</a></h3></div></summary><div class="impl-items"><div id="associatedtype.Inner-2" class="type trait-impl has-srclink"><a href="#associatedtype.Inner-2" class="anchor"></a><h4 class="code-header">type <a href="#associatedtype.Inner" class="type">Inner</a> = <a class="struct" href="../headers/www_authenticate/bearer/struct.Bearer.html" title="struct actix_web_httpauth::headers::www_authenticate::bearer::Bearer">Bearer</a></h4></div></div></details></div><script type="text/javascript" src="../../implementors/actix_web_httpauth/extractors/trait.AuthExtractorConfig.js" async></script></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
<script src="../../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
@ -1,13 +1,13 @@
|
||||
<!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="`Authorization` header and various auth schemes"><meta name="keywords" content="rust, rustlang, rust-lang, authorization"><title>actix_web_httpauth::headers::authorization - 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="../../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../../ayu.css" disabled ><script id="default-settings" ></script><script src="../../../storage.js"></script><script src="../../../crates.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../../../actix_web_httpauth/index.html'><div class='logo-container rust-logo'><img src='../../../rust-logo.png' alt='logo'></div></a><h2 class="location">Module authorization</h2><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li></ul></div><div id="sidebar-vars" data-name="authorization" data-ty="mod" data-relpath="./"></div><script defer src="./sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../../index.html">actix_web_httpauth</a>::<wbr><a href="../index.html">headers</a>::<wbr><a class="mod" href="#">authorization</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_httpauth/headers/authorization/mod.rs.html#1-11" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><code>Authorization</code> header and various auth schemes</p>
|
||||
</div></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.Authorization.html" title="actix_web_httpauth::headers::authorization::Authorization struct">Authorization</a></div><div class="item-right docblock-short"><p><code>Authorization</code> header, defined in <a href="https://tools.ietf.org/html/rfc7235#section-4.2">RFC 7235</a></p>
|
||||
</div><div class="item-left module-item"><a class="struct" href="struct.Basic.html" title="actix_web_httpauth::headers::authorization::Basic struct">Basic</a></div><div class="item-right docblock-short"><p>Credentials for <code>Basic</code> authentication scheme, defined in <a href="https://tools.ietf.org/html/rfc7617">RFC 7617</a></p>
|
||||
</div><div class="item-left module-item"><a class="struct" href="struct.Bearer.html" title="actix_web_httpauth::headers::authorization::Bearer struct">Bearer</a></div><div class="item-right docblock-short"><p>Credentials for <code>Bearer</code> authentication scheme, defined in <a href="https://tools.ietf.org/html/rfc6750">RFC6750</a></p>
|
||||
</div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="enum" href="enum.ParseError.html" title="actix_web_httpauth::headers::authorization::ParseError enum">ParseError</a></div><div class="item-right docblock-short"><p>Possible errors while parsing <code>Authorization</code> header.</p>
|
||||
</div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="trait" href="trait.Scheme.html" title="actix_web_httpauth::headers::authorization::Scheme trait">Scheme</a></div><div class="item-right docblock-short"><p>Authentication scheme for <a href="./struct.Authorization.html"><code>Authorization</code></a>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Authorization.html" title="actix_web_httpauth::headers::authorization::Authorization struct">Authorization</a></div><div class="item-right docblock-short"><p><code>Authorization</code> header, defined in <a href="https://tools.ietf.org/html/rfc7235#section-4.2">RFC 7235</a></p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Basic.html" title="actix_web_httpauth::headers::authorization::Basic struct">Basic</a></div><div class="item-right docblock-short"><p>Credentials for <code>Basic</code> authentication scheme, defined in <a href="https://tools.ietf.org/html/rfc7617">RFC 7617</a></p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Bearer.html" title="actix_web_httpauth::headers::authorization::Bearer struct">Bearer</a></div><div class="item-right docblock-short"><p>Credentials for <code>Bearer</code> authentication scheme, defined in <a href="https://tools.ietf.org/html/rfc6750">RFC6750</a></p>
|
||||
</div></div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.ParseError.html" title="actix_web_httpauth::headers::authorization::ParseError enum">ParseError</a></div><div class="item-right docblock-short"><p>Possible errors while parsing <code>Authorization</code> header.</p>
|
||||
</div></div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Scheme.html" title="actix_web_httpauth::headers::authorization::Scheme trait">Scheme</a></div><div class="item-right docblock-short"><p>Authentication scheme for <a href="./struct.Authorization.html"><code>Authorization</code></a>
|
||||
header.</p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../search-index.js" data-search-js="../../../search.js"></div>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../search-index.js" data-search-js="../../../search.js"></div>
|
||||
<script src="../../../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,8 +1,8 @@
|
||||
<!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="Authentication scheme for `Authorization` header."><meta name="keywords" content="rust, rustlang, rust-lang, Scheme"><title>Scheme in actix_web_httpauth::headers::authorization - 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="../../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../../ayu.css" disabled ><script id="default-settings" ></script><script src="../../../storage.js"></script><script src="../../../crates.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></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="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../../../actix_web_httpauth/index.html'><div class='logo-container rust-logo'><img src='../../../rust-logo.png' alt='logo'></div></a><h2 class="location">Trait Scheme</h2><div class="sidebar-elems"><div class="block items"><h3 class="sidebar-title"><a href="#required-methods">Required Methods</a></h3><div class="sidebar-links"><a href="#tymethod.parse">parse</a></div><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div><h2 class="location">Other items in<br><a href="../../index.html">actix_web_httpauth</a>::<wbr><a href="../index.html">headers</a>::<wbr><a href="index.html">authorization</a></h2><div id="sidebar-vars" data-name="Scheme" data-ty="trait" data-relpath=""></div><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Trait <a href="../../index.html">actix_web_httpauth</a>::<wbr><a href="../index.html">headers</a>::<wbr><a href="index.html">authorization</a>::<wbr><a class="trait" href="#">Scheme</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_httpauth/headers/authorization/scheme/mod.rs.html#12-15" title="goto source code">[src]</a></span></h1><div class="docblock type-decl"><pre class="rust trait"><code>pub trait Scheme: IntoHeaderValue + <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Display.html" title="trait core::fmt::Display">Display</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> {
|
||||
fn <a href="#tymethod.parse" class="fnname">parse</a>(header: &<a class="struct" href="https://docs.rs/http/0.2.4/http/header/value/struct.HeaderValue.html" title="struct http::header::value::HeaderValue">HeaderValue</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="enum" href="enum.ParseError.html" title="enum actix_web_httpauth::headers::authorization::ParseError">ParseError</a>>;
|
||||
fn <a href="#tymethod.parse" class="fnname">parse</a>(header: &<a class="struct" href="https://docs.rs/http/0.2.5/http/header/value/struct.HeaderValue.html" title="struct http::header::value::HeaderValue">HeaderValue</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="enum" href="enum.ParseError.html" title="enum actix_web_httpauth::headers::authorization::ParseError">ParseError</a>>;
|
||||
}</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Authentication scheme for <a href="./struct.Authorization.html"><code>Authorization</code></a>
|
||||
header.</p>
|
||||
</div></details><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.parse" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/actix_web_httpauth/headers/authorization/scheme/mod.rs.html#14" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.parse" class="fnname">parse</a>(header: &<a class="struct" href="https://docs.rs/http/0.2.4/http/header/value/struct.HeaderValue.html" title="struct http::header::value::HeaderValue">HeaderValue</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="enum" href="enum.ParseError.html" title="enum actix_web_httpauth::headers::authorization::ParseError">ParseError</a>></h4></div></summary><div class="docblock"><p>Try to parse the authentication scheme from the <code>Authorization</code> header.</p>
|
||||
</div></details><h2 id="required-methods" class="small-section-header">Required methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.parse" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/actix_web_httpauth/headers/authorization/scheme/mod.rs.html#14" title="goto source code">[src]</a></div><h4 class="code-header">fn <a href="#tymethod.parse" class="fnname">parse</a>(header: &<a class="struct" href="https://docs.rs/http/0.2.5/http/header/value/struct.HeaderValue.html" title="struct http::header::value::HeaderValue">HeaderValue</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="enum" href="enum.ParseError.html" title="enum actix_web_httpauth::headers::authorization::ParseError">ParseError</a>></h4></div></summary><div class="docblock"><p>Try to parse the authentication scheme from the <code>Authorization</code> header.</p>
|
||||
</div></details></div><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"><div id="impl-Scheme" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../../src/actix_web_httpauth/headers/authorization/scheme/basic.rs.html#50-83" title="goto source code">[src]</a></div><a href="#impl-Scheme" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.Scheme.html" title="trait actix_web_httpauth::headers::authorization::Scheme">Scheme</a> for <a class="struct" href="struct.Basic.html" title="struct actix_web_httpauth::headers::authorization::Basic">Basic</a></h3></div><div id="impl-Scheme-1" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../../src/actix_web_httpauth/headers/authorization/scheme/bearer.rs.html#43-62" title="goto source code">[src]</a></div><a href="#impl-Scheme-1" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="trait.Scheme.html" title="trait actix_web_httpauth::headers::authorization::Scheme">Scheme</a> for <a class="struct" href="struct.Bearer.html" title="struct actix_web_httpauth::headers::authorization::Bearer">Bearer</a></h3></div></div><script type="text/javascript" src="../../../implementors/actix_web_httpauth/headers/authorization/trait.Scheme.js" async></script></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../search-index.js" data-search-js="../../../search.js"></div>
|
||||
<script src="../../../main.js"></script>
|
||||
</body></html>
|
@ -1,7 +1,7 @@
|
||||
<!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="Typed HTTP headers"><meta name="keywords" content="rust, rustlang, rust-lang, headers"><title>actix_web_httpauth::headers - 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="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings" ></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../../actix_web_httpauth/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><h2 class="location">Module headers</h2><div class="sidebar-elems"><div class="block items"><ul><li><a href="#modules">Modules</a></li></ul></div><div id="sidebar-vars" data-name="headers" data-ty="mod" data-relpath="./"></div><script defer src="./sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">actix_web_httpauth</a>::<wbr><a class="mod" href="#">headers</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_httpauth/headers/mod.rs.html#1-4" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Typed HTTP headers</p>
|
||||
</div></details><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="mod" href="authorization/index.html" title="actix_web_httpauth::headers::authorization mod">authorization</a></div><div class="item-right docblock-short"><p><code>Authorization</code> header and various auth schemes</p>
|
||||
</div><div class="item-left module-item"><a class="mod" href="www_authenticate/index.html" title="actix_web_httpauth::headers::www_authenticate mod">www_authenticate</a></div><div class="item-right docblock-short"><p><code>WWW-Authenticate</code> header and various auth challenges</p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="authorization/index.html" title="actix_web_httpauth::headers::authorization mod">authorization</a></div><div class="item-right docblock-short"><p><code>Authorization</code> header and various auth schemes</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="www_authenticate/index.html" title="actix_web_httpauth::headers::www_authenticate mod">www_authenticate</a></div><div class="item-right docblock-short"><p><code>WWW-Authenticate</code> header and various auth challenges</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
<script src="../../main.js"></script>
|
||||
</body></html>
|
@ -1,7 +1,7 @@
|
||||
<!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="Challenge for the “Basic” HTTP Authentication Scheme"><meta name="keywords" content="rust, rustlang, rust-lang, basic"><title>actix_web_httpauth::headers::www_authenticate::basic - 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="../../../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../../../ayu.css" disabled ><script id="default-settings" ></script><script src="../../../../storage.js"></script><script src="../../../../crates.js"></script><noscript><link rel="stylesheet" href="../../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../../favicon.svg"><style type="text/css">#crate-search{background-image:url("../../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../../../../actix_web_httpauth/index.html'><div class='logo-container rust-logo'><img src='../../../../rust-logo.png' alt='logo'></div></a><h2 class="location">Module basic</h2><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><div id="sidebar-vars" data-name="basic" data-ty="mod" data-relpath="./"></div><script defer src="./sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../../../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../../../index.html">actix_web_httpauth</a>::<wbr><a href="../../index.html">headers</a>::<wbr><a href="../index.html">www_authenticate</a>::<wbr><a class="mod" href="#">basic</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_httpauth/headers/www_authenticate/challenge/basic.rs.html#1-140" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Challenge for the “Basic” HTTP Authentication Scheme</p>
|
||||
</div></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.Basic.html" title="actix_web_httpauth::headers::www_authenticate::basic::Basic struct">Basic</a></div><div class="item-right docblock-short"><p>Challenge for <a href="../struct.WwwAuthenticate.html"><code>WWW-Authenticate</code></a> header with HTTP Basic auth scheme,
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Basic.html" title="actix_web_httpauth::headers::www_authenticate::basic::Basic struct">Basic</a></div><div class="item-right docblock-short"><p>Challenge for <a href="../struct.WwwAuthenticate.html"><code>WWW-Authenticate</code></a> header with HTTP Basic auth scheme,
|
||||
described in <a href="https://tools.ietf.org/html/rfc7617">RFC 7617</a></p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../../search-index.js" data-search-js="../../../../search.js"></div>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../../search-index.js" data-search-js="../../../../search.js"></div>
|
||||
<script src="../../../../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,10 +1,10 @@
|
||||
<!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="Challenge for the “Bearer” HTTP Authentication Scheme"><meta name="keywords" content="rust, rustlang, rust-lang, bearer"><title>actix_web_httpauth::headers::www_authenticate::bearer - 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="../../../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../../../ayu.css" disabled ><script id="default-settings" ></script><script src="../../../../storage.js"></script><script src="../../../../crates.js"></script><noscript><link rel="stylesheet" href="../../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../../favicon.svg"><style type="text/css">#crate-search{background-image:url("../../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../../../../actix_web_httpauth/index.html'><div class='logo-container rust-logo'><img src='../../../../rust-logo.png' alt='logo'></div></a><h2 class="location">Module bearer</h2><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li></ul></div><div id="sidebar-vars" data-name="bearer" data-ty="mod" data-relpath="./"></div><script defer src="./sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../../../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../../../index.html">actix_web_httpauth</a>::<wbr><a href="../../index.html">headers</a>::<wbr><a href="../index.html">www_authenticate</a>::<wbr><a class="mod" href="#">bearer</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_httpauth/headers/www_authenticate/challenge/bearer/mod.rs.html#1-12" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Challenge for the “Bearer” HTTP Authentication Scheme</p>
|
||||
</div></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.Bearer.html" title="actix_web_httpauth::headers::www_authenticate::bearer::Bearer struct">Bearer</a></div><div class="item-right docblock-short"><p>Challenge for <a href="../struct.WwwAuthenticate.html"><code>WWW-Authenticate</code></a> header with HTTP Bearer auth scheme,
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Bearer.html" title="actix_web_httpauth::headers::www_authenticate::bearer::Bearer struct">Bearer</a></div><div class="item-right docblock-short"><p>Challenge for <a href="../struct.WwwAuthenticate.html"><code>WWW-Authenticate</code></a> header with HTTP Bearer auth scheme,
|
||||
described in <a href="https://tools.ietf.org/html/rfc6750#section-3">RFC 6750</a></p>
|
||||
</div><div class="item-left module-item"><a class="struct" href="struct.BearerBuilder.html" title="actix_web_httpauth::headers::www_authenticate::bearer::BearerBuilder struct">BearerBuilder</a></div><div class="item-right docblock-short"><p>Builder for the <a href="struct.Bearer.html"><code>Bearer</code></a> challenge.</p>
|
||||
</div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="enum" href="enum.Error.html" title="actix_web_httpauth::headers::www_authenticate::bearer::Error enum">Error</a></div><div class="item-right docblock-short"><p>Bearer authorization error types, described in <a href="https://tools.ietf.org/html/rfc6750#section-3.1">RFC 6750</a></p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../../search-index.js" data-search-js="../../../../search.js"></div>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.BearerBuilder.html" title="actix_web_httpauth::headers::www_authenticate::bearer::BearerBuilder struct">BearerBuilder</a></div><div class="item-right docblock-short"><p>Builder for the <a href="struct.Bearer.html"><code>Bearer</code></a> challenge.</p>
|
||||
</div></div></div><h2 id="enums" class="section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Error.html" title="actix_web_httpauth::headers::www_authenticate::bearer::Error enum">Error</a></div><div class="item-right docblock-short"><p>Bearer authorization error types, described in <a href="https://tools.ietf.org/html/rfc6750#section-3.1">RFC 6750</a></p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../../search-index.js" data-search-js="../../../../search.js"></div>
|
||||
<script src="../../../../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,11 +1,11 @@
|
||||
<!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="`WWW-Authenticate` header and various auth challenges"><meta name="keywords" content="rust, rustlang, rust-lang, www_authenticate"><title>actix_web_httpauth::headers::www_authenticate - 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="../../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../../ayu.css" disabled ><script id="default-settings" ></script><script src="../../../storage.js"></script><script src="../../../crates.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../../../actix_web_httpauth/index.html'><div class='logo-container rust-logo'><img src='../../../rust-logo.png' alt='logo'></div></a><h2 class="location">Module www_authenticate</h2><div class="sidebar-elems"><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#structs">Structs</a></li><li><a href="#traits">Traits</a></li></ul></div><div id="sidebar-vars" data-name="www_authenticate" data-ty="mod" data-relpath="./"></div><script defer src="./sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../../index.html">actix_web_httpauth</a>::<wbr><a href="../index.html">headers</a>::<wbr><a class="mod" href="#">www_authenticate</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_httpauth/headers/www_authenticate/mod.rs.html#1-9" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><code>WWW-Authenticate</code> header and various auth challenges</p>
|
||||
</div></details><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="mod" href="basic/index.html" title="actix_web_httpauth::headers::www_authenticate::basic mod">basic</a></div><div class="item-right docblock-short"><p>Challenge for the “Basic” HTTP Authentication Scheme</p>
|
||||
</div><div class="item-left module-item"><a class="mod" href="bearer/index.html" title="actix_web_httpauth::headers::www_authenticate::bearer mod">bearer</a></div><div class="item-right docblock-short"><p>Challenge for the “Bearer” HTTP Authentication Scheme</p>
|
||||
</div></div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.WwwAuthenticate.html" title="actix_web_httpauth::headers::www_authenticate::WwwAuthenticate struct">WwwAuthenticate</a></div><div class="item-right docblock-short"><p><code>WWW-Authenticate</code> header, described in <a href="https://tools.ietf.org/html/rfc7235#section-4.1">RFC 7235</a></p>
|
||||
</div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="trait" href="trait.Challenge.html" title="actix_web_httpauth::headers::www_authenticate::Challenge trait">Challenge</a></div><div class="item-right docblock-short"><p>Authentication challenge for <code>WWW-Authenticate</code> header.</p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../search-index.js" data-search-js="../../../search.js"></div>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="basic/index.html" title="actix_web_httpauth::headers::www_authenticate::basic mod">basic</a></div><div class="item-right docblock-short"><p>Challenge for the “Basic” HTTP Authentication Scheme</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="bearer/index.html" title="actix_web_httpauth::headers::www_authenticate::bearer mod">bearer</a></div><div class="item-right docblock-short"><p>Challenge for the “Bearer” HTTP Authentication Scheme</p>
|
||||
</div></div></div><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.WwwAuthenticate.html" title="actix_web_httpauth::headers::www_authenticate::WwwAuthenticate struct">WwwAuthenticate</a></div><div class="item-right docblock-short"><p><code>WWW-Authenticate</code> header, described in <a href="https://tools.ietf.org/html/rfc7235#section-4.1">RFC 7235</a></p>
|
||||
</div></div></div><h2 id="traits" class="section-header"><a href="#traits">Traits</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Challenge.html" title="actix_web_httpauth::headers::www_authenticate::Challenge trait">Challenge</a></div><div class="item-right docblock-short"><p>Authentication challenge for <code>WWW-Authenticate</code> header.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../search-index.js" data-search-js="../../../search.js"></div>
|
||||
<script src="../../../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
@ -5,15 +5,15 @@
|
||||
<li><a href="https://actix.rs/docs/extractors/">Extractors</a> for an <a href="headers/authorization/struct.Authorization.html">Authorization</a> header</li>
|
||||
<li><a href="./middleware">Middleware</a> for easier authorization checking</li>
|
||||
</ul>
|
||||
<h2 id="supported-schemes" class="section-header"><a href="#supported-schemes">Supported schemes</a></h2>
|
||||
<h3 id="supported-schemes" class="section-header"><a href="#supported-schemes">Supported schemes</a></h3>
|
||||
<ul>
|
||||
<li><code>Basic</code>, as defined in <a href="https://tools.ietf.org/html/rfc7617">RFC7617</a></li>
|
||||
<li><code>Bearer</code>, as defined in <a href="https://tools.ietf.org/html/rfc6750">RFC6750</a></li>
|
||||
</ul>
|
||||
</div></details><h2 id="modules" class="section-header"><a href="#modules">Modules</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="mod" href="extractors/index.html" title="actix_web_httpauth::extractors mod">extractors</a></div><div class="item-right docblock-short"><p>Type-safe authentication information extractors</p>
|
||||
</div><div class="item-left module-item"><a class="mod" href="headers/index.html" title="actix_web_httpauth::headers mod">headers</a></div><div class="item-right docblock-short"><p>Typed HTTP headers</p>
|
||||
</div><div class="item-left module-item"><a class="mod" href="middleware/index.html" title="actix_web_httpauth::middleware mod">middleware</a></div><div class="item-right docblock-short"><p>HTTP Authentication middleware.</p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_web_httpauth" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="mod" href="extractors/index.html" title="actix_web_httpauth::extractors mod">extractors</a></div><div class="item-right docblock-short"><p>Type-safe authentication information extractors</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="headers/index.html" title="actix_web_httpauth::headers mod">headers</a></div><div class="item-right docblock-short"><p>Typed HTTP headers</p>
|
||||
</div></div><div class="item-row"><div class="item-left module-item"><a class="mod" href="middleware/index.html" title="actix_web_httpauth::middleware mod">middleware</a></div><div class="item-right docblock-short"><p>HTTP Authentication middleware.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../" data-current-crate="actix_web_httpauth" data-search-index-js="../search-index.js" data-search-js="../search.js"></div>
|
||||
<script src="../main.js"></script>
|
||||
</body></html>
|
@ -1,6 +1,6 @@
|
||||
<!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="HTTP Authentication middleware."><meta name="keywords" content="rust, rustlang, rust-lang, middleware"><title>actix_web_httpauth::middleware - 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="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings" ></script><script src="../../storage.js"></script><script src="../../crates.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../favicon.svg"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a href='../../actix_web_httpauth/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><h2 class="location">Module middleware</h2><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><div id="sidebar-vars" data-name="middleware" data-ty="mod" data-relpath="./"></div><script defer src="./sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../wheel.svg"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="in-band">Module <a href="../index.html">actix_web_httpauth</a>::<wbr><a class="mod" href="#">middleware</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></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_httpauth/middleware.rs.html#1-312" title="goto source code">[src]</a></span></h1><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>HTTP Authentication middleware.</p>
|
||||
</div></details><h2 id="structs" class="section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-left module-item"><a class="struct" href="struct.HttpAuthentication.html" title="actix_web_httpauth::middleware::HttpAuthentication struct">HttpAuthentication</a></div><div class="item-right docblock-short"><p>Middleware for checking HTTP authentication.</p>
|
||||
</div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.HttpAuthentication.html" title="actix_web_httpauth::middleware::HttpAuthentication struct">HttpAuthentication</a></div><div class="item-right docblock-short"><p>Middleware for checking HTTP authentication.</p>
|
||||
</div></div></div></section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
<script src="../../main.js"></script>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
(function() {var implementors = {};
|
||||
implementors["actix_cors"] = [{"text":"impl<S> Transform<S, ServiceRequest> for <a class=\"struct\" href=\"actix_cors/struct.Cors.html\" title=\"struct actix_cors::Cors\">Cors</a> <span class=\"where fmt-newline\">where<br> S: Service<ServiceRequest, Response = ServiceResponse, Error = Error>,<br> S::Future: 'static, </span>","synthetic":false,"types":["actix_cors::builder::Cors"]}];
|
||||
implementors["actix_cors"] = [{"text":"impl<S, B> Transform<S, ServiceRequest> for <a class=\"struct\" href=\"actix_cors/struct.Cors.html\" title=\"struct actix_cors::Cors\">Cors</a> <span class=\"where fmt-newline\">where<br> S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,<br> S::Future: 'static,<br> B: MessageBody + 'static,<br> B::Error: <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/error/trait.Error.html\" title=\"trait std::error::Error\">StdError</a>, </span>","synthetic":false,"types":["actix_cors::builder::Cors"]}];
|
||||
implementors["actix_identity"] = [{"text":"impl<S, T, B> Transform<S, ServiceRequest> for <a class=\"struct\" href=\"actix_identity/struct.IdentityService.html\" title=\"struct actix_identity::IdentityService\">IdentityService</a><T> <span class=\"where fmt-newline\">where<br> S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,<br> S::Future: 'static,<br> T: <a class=\"trait\" href=\"actix_identity/trait.IdentityPolicy.html\" title=\"trait actix_identity::IdentityPolicy\">IdentityPolicy</a>,<br> B: MessageBody + 'static,<br> B::Error: <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/error/trait.Error.html\" title=\"trait std::error::Error\">StdError</a>, </span>","synthetic":false,"types":["actix_identity::middleware::IdentityService"]}];
|
||||
implementors["actix_redis"] = [{"text":"impl<S, B> Transform<S, ServiceRequest> for <a class=\"struct\" href=\"actix_redis/struct.RedisSession.html\" title=\"struct actix_redis::RedisSession\">RedisSession</a> <span class=\"where fmt-newline\">where<br> S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,<br> S::Future: 'static,<br> B: 'static, </span>","synthetic":false,"types":["actix_redis::session::RedisSession"]}];
|
||||
implementors["actix_session"] = [{"text":"impl<S, B> Transform<S, ServiceRequest> for <a class=\"struct\" href=\"actix_session/struct.CookieSession.html\" title=\"struct actix_session::CookieSession\">CookieSession</a> <span class=\"where fmt-newline\">where<br> S: Service<ServiceRequest, Response = ServiceResponse<B>>,<br> S::Future: 'static,<br> S::Error: 'static,<br> B: MessageBody + 'static,<br> B::Error: <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/std/error/trait.Error.html\" title=\"trait std::error::Error\">StdError</a>, </span>","synthetic":false,"types":["actix_session::cookie::CookieSession"]}];
|
||||
|
@ -1,5 +1,5 @@
|
||||
(function() {var implementors = {};
|
||||
implementors["actix_protobuf"] = [{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><PayloadError> for <a class=\"enum\" href=\"actix_protobuf/enum.ProtoBufPayloadError.html\" title=\"enum actix_protobuf::ProtoBufPayloadError\">ProtoBufPayloadError</a>","synthetic":false,"types":["actix_protobuf::ProtoBufPayloadError"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><<a class=\"struct\" href=\"https://docs.rs/prost/0.7.0/prost/error/struct.DecodeError.html\" title=\"struct prost::error::DecodeError\">DecodeError</a>> for <a class=\"enum\" href=\"actix_protobuf/enum.ProtoBufPayloadError.html\" title=\"enum actix_protobuf::ProtoBufPayloadError\">ProtoBufPayloadError</a>","synthetic":false,"types":["actix_protobuf::ProtoBufPayloadError"]}];
|
||||
implementors["actix_redis"] = [{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><<a class=\"enum\" href=\"actix_redis/enum.RespError.html\" title=\"enum actix_redis::RespError\">Error</a>> for <a class=\"enum\" href=\"actix_redis/enum.Error.html\" title=\"enum actix_redis::Error\">Error</a>","synthetic":false,"types":["actix_redis::Error"]}];
|
||||
implementors["actix_web_httpauth"] = [{"text":"impl<T> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><T> for <a class=\"struct\" href=\"actix_web_httpauth/extractors/struct.AuthenticationError.html\" title=\"struct actix_web_httpauth::extractors::AuthenticationError\">AuthenticationError</a><<T as <a class=\"trait\" href=\"actix_web_httpauth/extractors/trait.AuthExtractorConfig.html\" title=\"trait actix_web_httpauth::extractors::AuthExtractorConfig\">AuthExtractorConfig</a>>::<a class=\"type\" href=\"actix_web_httpauth/extractors/trait.AuthExtractorConfig.html#associatedtype.Inner\" title=\"type actix_web_httpauth::extractors::AuthExtractorConfig::Inner\">Inner</a>> <span class=\"where fmt-newline\">where<br> T: <a class=\"trait\" href=\"actix_web_httpauth/extractors/trait.AuthExtractorConfig.html\" title=\"trait actix_web_httpauth::extractors::AuthExtractorConfig\">AuthExtractorConfig</a>, </span>","synthetic":false,"types":["actix_web_httpauth::extractors::errors::AuthenticationError"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><<a class=\"struct\" href=\"https://docs.rs/http/0.2.4/http/header/value/struct.ToStrError.html\" title=\"struct http::header::value::ToStrError\">ToStrError</a>> for <a class=\"enum\" href=\"actix_web_httpauth/headers/authorization/enum.ParseError.html\" title=\"enum actix_web_httpauth::headers::authorization::ParseError\">ParseError</a>","synthetic":false,"types":["actix_web_httpauth::headers::authorization::errors::ParseError"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><DecodeError> for <a class=\"enum\" href=\"actix_web_httpauth/headers/authorization/enum.ParseError.html\" title=\"enum actix_web_httpauth::headers::authorization::ParseError\">ParseError</a>","synthetic":false,"types":["actix_web_httpauth::headers::authorization::errors::ParseError"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/core/str/error/struct.Utf8Error.html\" title=\"struct core::str::error::Utf8Error\">Utf8Error</a>> for <a class=\"enum\" href=\"actix_web_httpauth/headers/authorization/enum.ParseError.html\" title=\"enum actix_web_httpauth::headers::authorization::ParseError\">ParseError</a>","synthetic":false,"types":["actix_web_httpauth::headers::authorization::errors::ParseError"]},{"text":"impl<S> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><S> for <a class=\"struct\" href=\"actix_web_httpauth/headers/authorization/struct.Authorization.html\" title=\"struct actix_web_httpauth::headers::authorization::Authorization\">Authorization</a><S> <span class=\"where fmt-newline\">where<br> S: <a class=\"trait\" href=\"actix_web_httpauth/headers/authorization/trait.Scheme.html\" title=\"trait actix_web_httpauth::headers::authorization::Scheme\">Scheme</a>, </span>","synthetic":false,"types":["actix_web_httpauth::headers::authorization::header::Authorization"]}];
|
||||
implementors["actix_web_httpauth"] = [{"text":"impl<T> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><T> for <a class=\"struct\" href=\"actix_web_httpauth/extractors/struct.AuthenticationError.html\" title=\"struct actix_web_httpauth::extractors::AuthenticationError\">AuthenticationError</a><<T as <a class=\"trait\" href=\"actix_web_httpauth/extractors/trait.AuthExtractorConfig.html\" title=\"trait actix_web_httpauth::extractors::AuthExtractorConfig\">AuthExtractorConfig</a>>::<a class=\"type\" href=\"actix_web_httpauth/extractors/trait.AuthExtractorConfig.html#associatedtype.Inner\" title=\"type actix_web_httpauth::extractors::AuthExtractorConfig::Inner\">Inner</a>> <span class=\"where fmt-newline\">where<br> T: <a class=\"trait\" href=\"actix_web_httpauth/extractors/trait.AuthExtractorConfig.html\" title=\"trait actix_web_httpauth::extractors::AuthExtractorConfig\">AuthExtractorConfig</a>, </span>","synthetic":false,"types":["actix_web_httpauth::extractors::errors::AuthenticationError"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><<a class=\"struct\" href=\"https://docs.rs/http/0.2.5/http/header/value/struct.ToStrError.html\" title=\"struct http::header::value::ToStrError\">ToStrError</a>> for <a class=\"enum\" href=\"actix_web_httpauth/headers/authorization/enum.ParseError.html\" title=\"enum actix_web_httpauth::headers::authorization::ParseError\">ParseError</a>","synthetic":false,"types":["actix_web_httpauth::headers::authorization::errors::ParseError"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><DecodeError> for <a class=\"enum\" href=\"actix_web_httpauth/headers/authorization/enum.ParseError.html\" title=\"enum actix_web_httpauth::headers::authorization::ParseError\">ParseError</a>","synthetic":false,"types":["actix_web_httpauth::headers::authorization::errors::ParseError"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><<a class=\"struct\" href=\"https://doc.rust-lang.org/nightly/core/str/error/struct.Utf8Error.html\" title=\"struct core::str::error::Utf8Error\">Utf8Error</a>> for <a class=\"enum\" href=\"actix_web_httpauth/headers/authorization/enum.ParseError.html\" title=\"enum actix_web_httpauth::headers::authorization::ParseError\">ParseError</a>","synthetic":false,"types":["actix_web_httpauth::headers::authorization::errors::ParseError"]},{"text":"impl<S> <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/convert/trait.From.html\" title=\"trait core::convert::From\">From</a><S> for <a class=\"struct\" href=\"actix_web_httpauth/headers/authorization/struct.Authorization.html\" title=\"struct actix_web_httpauth::headers::authorization::Authorization\">Authorization</a><S> <span class=\"where fmt-newline\">where<br> S: <a class=\"trait\" href=\"actix_web_httpauth/headers/authorization/trait.Scheme.html\" title=\"trait actix_web_httpauth::headers::authorization::Scheme\">Scheme</a>, </span>","synthetic":false,"types":["actix_web_httpauth::headers::authorization::header::Authorization"]}];
|
||||
if (window.register_implementors) {window.register_implementors(implementors);} else {window.pending_implementors = implementors;}})()
|
@ -1,7 +1,7 @@
|
||||
(function() {var implementors = {};
|
||||
implementors["actix_cors"] = [{"text":"impl Freeze for <a class=\"struct\" href=\"actix_cors/struct.Cors.html\" title=\"struct actix_cors::Cors\">Cors</a>","synthetic":true,"types":["actix_cors::builder::Cors"]},{"text":"impl Freeze for <a class=\"enum\" href=\"actix_cors/enum.CorsError.html\" title=\"enum actix_cors::CorsError\">CorsError</a>","synthetic":true,"types":["actix_cors::error::CorsError"]}];
|
||||
implementors["actix_identity"] = [{"text":"impl Freeze for <a class=\"struct\" href=\"actix_identity/struct.CookieIdentityPolicy.html\" title=\"struct actix_identity::CookieIdentityPolicy\">CookieIdentityPolicy</a>","synthetic":true,"types":["actix_identity::cookie::CookieIdentityPolicy"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_identity/struct.Identity.html\" title=\"struct actix_identity::Identity\">Identity</a>","synthetic":true,"types":["actix_identity::identity::Identity"]},{"text":"impl<T> Freeze for <a class=\"struct\" href=\"actix_identity/struct.IdentityService.html\" title=\"struct actix_identity::IdentityService\">IdentityService</a><T>","synthetic":true,"types":["actix_identity::middleware::IdentityService"]}];
|
||||
implementors["actix_protobuf"] = [{"text":"impl Freeze for <a class=\"enum\" href=\"actix_protobuf/enum.ProtoBufPayloadError.html\" title=\"enum actix_protobuf::ProtoBufPayloadError\">ProtoBufPayloadError</a>","synthetic":true,"types":["actix_protobuf::ProtoBufPayloadError"]},{"text":"impl<T> Freeze for <a class=\"struct\" href=\"actix_protobuf/struct.ProtoBuf.html\" title=\"struct actix_protobuf::ProtoBuf\">ProtoBuf</a><T> <span class=\"where fmt-newline\">where<br> T: Freeze, </span>","synthetic":true,"types":["actix_protobuf::ProtoBuf"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_protobuf/struct.ProtoBufConfig.html\" title=\"struct actix_protobuf::ProtoBufConfig\">ProtoBufConfig</a>","synthetic":true,"types":["actix_protobuf::ProtoBufConfig"]},{"text":"impl<T> Freeze for <a class=\"struct\" href=\"actix_protobuf/struct.ProtoBufMessage.html\" title=\"struct actix_protobuf::ProtoBufMessage\">ProtoBufMessage</a><T>","synthetic":true,"types":["actix_protobuf::ProtoBufMessage"]}];
|
||||
implementors["actix_protobuf"] = [{"text":"impl !Freeze for <a class=\"enum\" href=\"actix_protobuf/enum.ProtoBufPayloadError.html\" title=\"enum actix_protobuf::ProtoBufPayloadError\">ProtoBufPayloadError</a>","synthetic":true,"types":["actix_protobuf::ProtoBufPayloadError"]},{"text":"impl<T> Freeze for <a class=\"struct\" href=\"actix_protobuf/struct.ProtoBuf.html\" title=\"struct actix_protobuf::ProtoBuf\">ProtoBuf</a><T> <span class=\"where fmt-newline\">where<br> T: Freeze, </span>","synthetic":true,"types":["actix_protobuf::ProtoBuf"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_protobuf/struct.ProtoBufConfig.html\" title=\"struct actix_protobuf::ProtoBufConfig\">ProtoBufConfig</a>","synthetic":true,"types":["actix_protobuf::ProtoBufConfig"]},{"text":"impl<T> !Freeze for <a class=\"struct\" href=\"actix_protobuf/struct.ProtoBufMessage.html\" title=\"struct actix_protobuf::ProtoBufMessage\">ProtoBufMessage</a><T>","synthetic":true,"types":["actix_protobuf::ProtoBufMessage"]}];
|
||||
implementors["actix_redis"] = [{"text":"impl Freeze for <a class=\"struct\" href=\"actix_redis/struct.Command.html\" title=\"struct actix_redis::Command\">Command</a>","synthetic":true,"types":["actix_redis::redis::Command"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_redis/struct.RedisActor.html\" title=\"struct actix_redis::RedisActor\">RedisActor</a>","synthetic":true,"types":["actix_redis::redis::RedisActor"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_redis/struct.RedisSession.html\" title=\"struct actix_redis::RedisSession\">RedisSession</a>","synthetic":true,"types":["actix_redis::session::RedisSession"]},{"text":"impl Freeze for <a class=\"enum\" href=\"actix_redis/enum.Error.html\" title=\"enum actix_redis::Error\">Error</a>","synthetic":true,"types":["actix_redis::Error"]}];
|
||||
implementors["actix_session"] = [{"text":"impl Freeze for <a class=\"struct\" href=\"actix_session/struct.CookieSession.html\" title=\"struct actix_session::CookieSession\">CookieSession</a>","synthetic":true,"types":["actix_session::cookie::CookieSession"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_session/struct.Session.html\" title=\"struct actix_session::Session\">Session</a>","synthetic":true,"types":["actix_session::Session"]},{"text":"impl Freeze for <a class=\"enum\" href=\"actix_session/enum.SessionStatus.html\" title=\"enum actix_session::SessionStatus\">SessionStatus</a>","synthetic":true,"types":["actix_session::SessionStatus"]}];
|
||||
implementors["actix_web_httpauth"] = [{"text":"impl Freeze for <a class=\"struct\" href=\"actix_web_httpauth/extractors/basic/struct.Config.html\" title=\"struct actix_web_httpauth::extractors::basic::Config\">Config</a>","synthetic":true,"types":["actix_web_httpauth::extractors::basic::Config"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_web_httpauth/extractors/basic/struct.BasicAuth.html\" title=\"struct actix_web_httpauth::extractors::basic::BasicAuth\">BasicAuth</a>","synthetic":true,"types":["actix_web_httpauth::extractors::basic::BasicAuth"]},{"text":"impl Freeze for <a class=\"enum\" href=\"actix_web_httpauth/extractors/bearer/enum.Error.html\" title=\"enum actix_web_httpauth::extractors::bearer::Error\">Error</a>","synthetic":true,"types":["actix_web_httpauth::headers::www_authenticate::challenge::bearer::errors::Error"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_web_httpauth/extractors/bearer/struct.Config.html\" title=\"struct actix_web_httpauth::extractors::bearer::Config\">Config</a>","synthetic":true,"types":["actix_web_httpauth::extractors::bearer::Config"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_web_httpauth/extractors/bearer/struct.BearerAuth.html\" title=\"struct actix_web_httpauth::extractors::bearer::BearerAuth\">BearerAuth</a>","synthetic":true,"types":["actix_web_httpauth::extractors::bearer::BearerAuth"]},{"text":"impl<C> Freeze for <a class=\"struct\" href=\"actix_web_httpauth/extractors/struct.AuthenticationError.html\" title=\"struct actix_web_httpauth::extractors::AuthenticationError\">AuthenticationError</a><C> <span class=\"where fmt-newline\">where<br> C: Freeze, </span>","synthetic":true,"types":["actix_web_httpauth::extractors::errors::AuthenticationError"]},{"text":"impl Freeze for <a class=\"enum\" href=\"actix_web_httpauth/headers/authorization/enum.ParseError.html\" title=\"enum actix_web_httpauth::headers::authorization::ParseError\">ParseError</a>","synthetic":true,"types":["actix_web_httpauth::headers::authorization::errors::ParseError"]},{"text":"impl<S> Freeze for <a class=\"struct\" href=\"actix_web_httpauth/headers/authorization/struct.Authorization.html\" title=\"struct actix_web_httpauth::headers::authorization::Authorization\">Authorization</a><S> <span class=\"where fmt-newline\">where<br> S: Freeze, </span>","synthetic":true,"types":["actix_web_httpauth::headers::authorization::header::Authorization"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_web_httpauth/headers/authorization/struct.Basic.html\" title=\"struct actix_web_httpauth::headers::authorization::Basic\">Basic</a>","synthetic":true,"types":["actix_web_httpauth::headers::authorization::scheme::basic::Basic"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_web_httpauth/headers/authorization/struct.Bearer.html\" title=\"struct actix_web_httpauth::headers::authorization::Bearer\">Bearer</a>","synthetic":true,"types":["actix_web_httpauth::headers::authorization::scheme::bearer::Bearer"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_web_httpauth/headers/www_authenticate/basic/struct.Basic.html\" title=\"struct actix_web_httpauth::headers::www_authenticate::basic::Basic\">Basic</a>","synthetic":true,"types":["actix_web_httpauth::headers::www_authenticate::challenge::basic::Basic"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_web_httpauth/headers/www_authenticate/bearer/struct.BearerBuilder.html\" title=\"struct actix_web_httpauth::headers::www_authenticate::bearer::BearerBuilder\">BearerBuilder</a>","synthetic":true,"types":["actix_web_httpauth::headers::www_authenticate::challenge::bearer::builder::BearerBuilder"]},{"text":"impl Freeze for <a class=\"struct\" href=\"actix_web_httpauth/headers/www_authenticate/bearer/struct.Bearer.html\" title=\"struct actix_web_httpauth::headers::www_authenticate::bearer::Bearer\">Bearer</a>","synthetic":true,"types":["actix_web_httpauth::headers::www_authenticate::challenge::bearer::challenge::Bearer"]},{"text":"impl<C> Freeze for <a class=\"struct\" href=\"actix_web_httpauth/headers/www_authenticate/struct.WwwAuthenticate.html\" title=\"struct actix_web_httpauth::headers::www_authenticate::WwwAuthenticate\">WwwAuthenticate</a><C> <span class=\"where fmt-newline\">where<br> C: Freeze, </span>","synthetic":true,"types":["actix_web_httpauth::headers::www_authenticate::header::WwwAuthenticate"]},{"text":"impl<T, F> Freeze for <a class=\"struct\" href=\"actix_web_httpauth/middleware/struct.HttpAuthentication.html\" title=\"struct actix_web_httpauth::middleware::HttpAuthentication\">HttpAuthentication</a><T, F>","synthetic":true,"types":["actix_web_httpauth::middleware::HttpAuthentication"]}];
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -65,36 +65,36 @@
|
||||
|
||||
<span class="doccomment">/// Default as `AllOrSome::All`.</span>
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> <span class="ident">Default</span> <span class="kw">for</span> <span class="ident">AllOrSome</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">default</span>() <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">fn</span> <span class="ident">default</span>() -> <span class="self">Self</span> {
|
||||
<span class="ident">AllOrSome::All</span>
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> <span class="ident">AllOrSome</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="doccomment">/// Returns whether this is an `All` variant.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">is_all</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">bool</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">is_all</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">bool</span> {
|
||||
<span class="macro">matches!</span>(<span class="self">self</span>, <span class="ident">AllOrSome::All</span>)
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Returns whether this is a `Some` variant.</span>
|
||||
<span class="attribute">#[<span class="ident">allow</span>(<span class="ident">dead_code</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">is_some</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">bool</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">is_some</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">bool</span> {
|
||||
<span class="op">!</span><span class="self">self</span>.<span class="ident">is_all</span>()
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Provides a shared reference to `T` if variant is `Some`.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">as_ref</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">as_ref</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">match</span> <span class="kw-2">*</span><span class="self">self</span> {
|
||||
<span class="ident">AllOrSome::All</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">None</span>,
|
||||
<span class="ident">AllOrSome::Some</span>(<span class="kw-2">ref</span> <span class="ident">t</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Some</span>(<span class="ident">t</span>),
|
||||
<span class="ident">AllOrSome::All</span> => <span class="prelude-val">None</span>,
|
||||
<span class="ident">AllOrSome::Some</span>(<span class="kw-2">ref</span> <span class="ident">t</span>) => <span class="prelude-val">Some</span>(<span class="ident">t</span>),
|
||||
}
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Provides a mutable reference to `T` if variant is `Some`.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">as_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">as_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">match</span> <span class="kw-2">*</span><span class="self">self</span> {
|
||||
<span class="ident">AllOrSome::All</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">None</span>,
|
||||
<span class="ident">AllOrSome::Some</span>(<span class="kw-2">ref</span> <span class="kw-2">mut</span> <span class="ident">t</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Some</span>(<span class="ident">t</span>),
|
||||
<span class="ident">AllOrSome::All</span> => <span class="prelude-val">None</span>,
|
||||
<span class="ident">AllOrSome::Some</span>(<span class="kw-2">ref</span> <span class="kw-2">mut</span> <span class="ident">t</span>) => <span class="prelude-val">Some</span>(<span class="ident">t</span>),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -617,9 +617,45 @@
|
||||
<span id="617">617</span>
|
||||
<span id="618">618</span>
|
||||
<span id="619">619</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">collections::HashSet</span>, <span class="ident">convert::TryInto</span>, <span class="ident">iter::FromIterator</span>, <span class="ident">rc::Rc</span>};
|
||||
<span id="620">620</span>
|
||||
<span id="621">621</span>
|
||||
<span id="622">622</span>
|
||||
<span id="623">623</span>
|
||||
<span id="624">624</span>
|
||||
<span id="625">625</span>
|
||||
<span id="626">626</span>
|
||||
<span id="627">627</span>
|
||||
<span id="628">628</span>
|
||||
<span id="629">629</span>
|
||||
<span id="630">630</span>
|
||||
<span id="631">631</span>
|
||||
<span id="632">632</span>
|
||||
<span id="633">633</span>
|
||||
<span id="634">634</span>
|
||||
<span id="635">635</span>
|
||||
<span id="636">636</span>
|
||||
<span id="637">637</span>
|
||||
<span id="638">638</span>
|
||||
<span id="639">639</span>
|
||||
<span id="640">640</span>
|
||||
<span id="641">641</span>
|
||||
<span id="642">642</span>
|
||||
<span id="643">643</span>
|
||||
<span id="644">644</span>
|
||||
<span id="645">645</span>
|
||||
<span id="646">646</span>
|
||||
<span id="647">647</span>
|
||||
<span id="648">648</span>
|
||||
<span id="649">649</span>
|
||||
<span id="650">650</span>
|
||||
<span id="651">651</span>
|
||||
<span id="652">652</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std</span>::{
|
||||
<span class="ident">collections::HashSet</span>, <span class="ident">convert::TryInto</span>, <span class="ident">error::Error</span> <span class="kw">as</span> <span class="ident">StdError</span>, <span class="ident">iter::FromIterator</span>, <span class="ident">rc::Rc</span>,
|
||||
};
|
||||
|
||||
<span class="kw">use</span> <span class="ident">actix_web</span>::{
|
||||
<span class="ident">body::MessageBody</span>,
|
||||
<span class="ident">dev</span>::{<span class="ident">RequestHead</span>, <span class="ident">Service</span>, <span class="ident">ServiceRequest</span>, <span class="ident">ServiceResponse</span>, <span class="ident">Transform</span>},
|
||||
<span class="ident">error</span>::{<span class="ident">Error</span>, <span class="prelude-ty">Result</span>},
|
||||
<span class="ident">http</span>::{<span class="self">self</span>, <span class="ident">header::HeaderName</span>, <span class="ident">Error</span> <span class="kw">as</span> <span class="ident">HttpError</span>, <span class="ident">HeaderValue</span>, <span class="ident">Method</span>, <span class="ident">Uri</span>},
|
||||
@ -637,7 +673,7 @@
|
||||
<span class="kw">fn</span> <span class="ident">cors</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span>(
|
||||
<span class="ident">inner</span>: <span class="kw-2">&</span><span class="lifetime">'a</span> <span class="kw-2">mut</span> <span class="ident">Rc</span><span class="op"><</span><span class="ident">Inner</span><span class="op">></span>,
|
||||
<span class="ident">err</span>: <span class="kw-2">&</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Either</span><span class="op"><</span><span class="ident">http::Error</span>, <span class="ident">CorsError</span><span class="op">></span><span class="op">></span>,
|
||||
) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="lifetime">'a</span> <span class="kw-2">mut</span> <span class="ident">Inner</span><span class="op">></span> {
|
||||
) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="lifetime">'a</span> <span class="kw-2">mut</span> <span class="ident">Inner</span><span class="op">></span> {
|
||||
<span class="kw">if</span> <span class="ident">err</span>.<span class="ident">is_some</span>() {
|
||||
<span class="kw">return</span> <span class="prelude-val">None</span>;
|
||||
}
|
||||
@ -698,7 +734,7 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// *All* origins, methods, request headers and exposed headers allowed. Credentials supported.</span>
|
||||
<span class="doccomment">/// Max age 1 hour. Does not send wildcard.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">permissive</span>() <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">permissive</span>() -> <span class="self">Self</span> {
|
||||
<span class="kw">let</span> <span class="ident">inner</span> <span class="op">=</span> <span class="ident">Inner</span> {
|
||||
<span class="ident">allowed_origins</span>: <span class="ident">AllOrSome::All</span>,
|
||||
<span class="ident">allowed_origins_fns</span>: <span class="macro">smallvec!</span>[],
|
||||
@ -727,7 +763,7 @@
|
||||
<span class="doccomment">/// Resets allowed origin list to a state where any origin is accepted.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// See [`Cors::allowed_origin`] for more info on allowed origins.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allow_any_origin</span>(<span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allow_any_origin</span>(<span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="ident">Cors</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="ident">cors</span>.<span class="ident">allowed_origins</span> <span class="op">=</span> <span class="ident">AllOrSome::All</span>;
|
||||
}
|
||||
@ -759,15 +795,15 @@
|
||||
<span class="doccomment">/// - If supplied origin is a wildcard (`*`). [`Cors::send_wildcard`] should be used instead.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// [Fetch Standard]: https://fetch.spec.whatwg.org/#origin-header</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allowed_origin</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">origin</span>: <span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allowed_origin</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">origin</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="ident">Cors</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="kw">match</span> <span class="ident">TryInto</span>::<span class="op"><</span><span class="ident">Uri</span><span class="op">></span><span class="ident">::try_into</span>(<span class="ident">origin</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="kw">if</span> <span class="ident">origin</span> <span class="op">=</span><span class="op">=</span> <span class="string">"*"</span> <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="kw">if</span> <span class="ident">origin</span> <span class="op">==</span> <span class="string">"*"</span> => {
|
||||
<span class="macro">error!</span>(<span class="string">"Wildcard in `allowed_origin` is not allowed. Use `send_wildcard`."</span>);
|
||||
<span class="self">self</span>.<span class="ident">error</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">Either::Right</span>(<span class="ident">CorsError::WildcardOrigin</span>));
|
||||
}
|
||||
|
||||
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) => {
|
||||
<span class="kw">if</span> <span class="ident">cors</span>.<span class="ident">allowed_origins</span>.<span class="ident">is_all</span>() {
|
||||
<span class="ident">cors</span>.<span class="ident">allowed_origins</span> <span class="op">=</span> <span class="ident">AllOrSome::Some</span>(<span class="ident">HashSet::with_capacity</span>(<span class="number">8</span>));
|
||||
}
|
||||
@ -779,7 +815,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) => {
|
||||
<span class="self">self</span>.<span class="ident">error</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">Either::Left</span>(<span class="ident">err</span>.<span class="ident">into</span>()));
|
||||
}
|
||||
}
|
||||
@ -796,9 +832,9 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// If the function returns `true`, the client's `Origin` request header will be echoed back</span>
|
||||
<span class="doccomment">/// into the `Access-Control-Allow-Origin` response header.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allowed_origin_fn</span><span class="op"><</span><span class="ident">F</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">f</span>: <span class="ident">F</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allowed_origin_fn</span><span class="op"><</span><span class="ident">F</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">f</span>: <span class="ident">F</span>) -> <span class="ident">Cors</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">F</span>: (<span class="ident">Fn</span>(<span class="kw-2">&</span><span class="ident">HeaderValue</span>, <span class="kw-2">&</span><span class="ident">RequestHead</span>) <span class="op">-</span><span class="op">></span> <span class="ident">bool</span>) <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">F</span>: (<span class="ident">Fn</span>(<span class="kw-2">&</span><span class="ident">HeaderValue</span>, <span class="kw-2">&</span><span class="ident">RequestHead</span>) -> <span class="ident">bool</span>) <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
{
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="ident">cors</span>.<span class="ident">allowed_origins_fns</span>.<span class="ident">push</span>(<span class="ident">OriginFn</span> {
|
||||
@ -812,7 +848,7 @@
|
||||
<span class="doccomment">/// Resets allowed methods list to all methods.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// See [`Cors::allowed_methods`] for more info on allowed methods.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allow_any_method</span>(<span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allow_any_method</span>(<span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="ident">Cors</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="ident">cors</span>.<span class="ident">allowed_methods</span> <span class="op">=</span> <span class="ident">ALL_METHODS_SET</span>.<span class="ident">clone</span>();
|
||||
}
|
||||
@ -828,7 +864,7 @@
|
||||
<span class="doccomment">/// Defaults to `[GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE]`</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// [Fetch Standard CORS protocol]: https://fetch.spec.whatwg.org/#http-cors-protocol</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allowed_methods</span><span class="op"><</span><span class="ident">U</span>, <span class="ident">M</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">methods</span>: <span class="ident">U</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allowed_methods</span><span class="op"><</span><span class="ident">U</span>, <span class="ident">M</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">methods</span>: <span class="ident">U</span>) -> <span class="ident">Cors</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">U</span>: <span class="ident">IntoIterator</span><span class="op"><</span><span class="ident">Item</span> <span class="op">=</span> <span class="ident">M</span><span class="op">></span>,
|
||||
<span class="ident">M</span>: <span class="ident">TryInto</span><span class="op"><</span><span class="ident">Method</span><span class="op">></span>,
|
||||
@ -837,11 +873,11 @@
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="kw">for</span> <span class="ident">m</span> <span class="kw">in</span> <span class="ident">methods</span> {
|
||||
<span class="kw">match</span> <span class="ident">m</span>.<span class="ident">try_into</span>() {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">method</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">method</span>) => {
|
||||
<span class="ident">cors</span>.<span class="ident">allowed_methods</span>.<span class="ident">insert</span>(<span class="ident">method</span>);
|
||||
}
|
||||
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) => {
|
||||
<span class="self">self</span>.<span class="ident">error</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">Either::Left</span>(<span class="ident">err</span>.<span class="ident">into</span>()));
|
||||
<span class="kw">break</span>;
|
||||
}
|
||||
@ -855,7 +891,7 @@
|
||||
<span class="doccomment">/// Resets allowed request header list to a state where any header is accepted.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// See [`Cors::allowed_headers`] for more info on allowed request headers.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allow_any_header</span>(<span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allow_any_header</span>(<span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="ident">Cors</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="ident">cors</span>.<span class="ident">allowed_headers</span> <span class="op">=</span> <span class="ident">AllOrSome::All</span>;
|
||||
}
|
||||
@ -866,14 +902,14 @@
|
||||
<span class="doccomment">/// Add an allowed request header.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// See [`Cors::allowed_headers`] for more info on allowed request headers.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allowed_header</span><span class="op"><</span><span class="ident">H</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">header</span>: <span class="ident">H</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allowed_header</span><span class="op"><</span><span class="ident">H</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">header</span>: <span class="ident">H</span>) -> <span class="ident">Cors</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">H</span>: <span class="ident">TryInto</span><span class="op"><</span><span class="ident">HeaderName</span><span class="op">></span>,
|
||||
<span class="op"><</span><span class="ident">H</span> <span class="kw">as</span> <span class="ident">TryInto</span><span class="op"><</span><span class="ident">HeaderName</span><span class="op">></span><span class="op">></span><span class="ident">::Error</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">HttpError</span><span class="op">></span>,
|
||||
{
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="kw">match</span> <span class="ident">header</span>.<span class="ident">try_into</span>() {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">method</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">method</span>) => {
|
||||
<span class="kw">if</span> <span class="ident">cors</span>.<span class="ident">allowed_headers</span>.<span class="ident">is_all</span>() {
|
||||
<span class="ident">cors</span>.<span class="ident">allowed_headers</span> <span class="op">=</span> <span class="ident">AllOrSome::Some</span>(<span class="ident">HashSet::with_capacity</span>(<span class="number">8</span>));
|
||||
}
|
||||
@ -883,7 +919,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> <span class="self">self</span>.<span class="ident">error</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">Either::Left</span>(<span class="ident">err</span>.<span class="ident">into</span>())),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) => <span class="self">self</span>.<span class="ident">error</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">Either::Left</span>(<span class="ident">err</span>.<span class="ident">into</span>())),
|
||||
}
|
||||
}
|
||||
|
||||
@ -900,7 +936,7 @@
|
||||
<span class="doccomment">/// Defaults to `All`.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// [Fetch Standard CORS protocol]: https://fetch.spec.whatwg.org/#http-cors-protocol</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allowed_headers</span><span class="op"><</span><span class="ident">U</span>, <span class="ident">H</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">headers</span>: <span class="ident">U</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">allowed_headers</span><span class="op"><</span><span class="ident">U</span>, <span class="ident">H</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">headers</span>: <span class="ident">U</span>) -> <span class="ident">Cors</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">U</span>: <span class="ident">IntoIterator</span><span class="op"><</span><span class="ident">Item</span> <span class="op">=</span> <span class="ident">H</span><span class="op">></span>,
|
||||
<span class="ident">H</span>: <span class="ident">TryInto</span><span class="op"><</span><span class="ident">HeaderName</span><span class="op">></span>,
|
||||
@ -909,7 +945,7 @@
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="kw">for</span> <span class="ident">h</span> <span class="kw">in</span> <span class="ident">headers</span> {
|
||||
<span class="kw">match</span> <span class="ident">h</span>.<span class="ident">try_into</span>() {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">method</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">method</span>) => {
|
||||
<span class="kw">if</span> <span class="ident">cors</span>.<span class="ident">allowed_headers</span>.<span class="ident">is_all</span>() {
|
||||
<span class="ident">cors</span>.<span class="ident">allowed_headers</span> <span class="op">=</span> <span class="ident">AllOrSome::Some</span>(<span class="ident">HashSet::with_capacity</span>(<span class="number">8</span>));
|
||||
}
|
||||
@ -918,7 +954,7 @@
|
||||
<span class="ident">headers</span>.<span class="ident">insert</span>(<span class="ident">method</span>);
|
||||
}
|
||||
}
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) => {
|
||||
<span class="self">self</span>.<span class="ident">error</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">Either::Left</span>(<span class="ident">err</span>.<span class="ident">into</span>()));
|
||||
<span class="kw">break</span>;
|
||||
}
|
||||
@ -932,7 +968,7 @@
|
||||
<span class="doccomment">/// Resets exposed response header list to a state where any header is accepted.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// See [`Cors::expose_headers`] for more info on exposed response headers.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">expose_any_header</span>(<span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">expose_any_header</span>(<span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="ident">Cors</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="ident">cors</span>.<span class="ident">expose_headers</span> <span class="op">=</span> <span class="ident">AllOrSome::All</span>;
|
||||
}
|
||||
@ -947,7 +983,7 @@
|
||||
<span class="doccomment">/// This defaults to an empty set.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// [Fetch Standard CORS protocol]: https://fetch.spec.whatwg.org/#http-cors-protocol</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">expose_headers</span><span class="op"><</span><span class="ident">U</span>, <span class="ident">H</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">headers</span>: <span class="ident">U</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">expose_headers</span><span class="op"><</span><span class="ident">U</span>, <span class="ident">H</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">headers</span>: <span class="ident">U</span>) -> <span class="ident">Cors</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">U</span>: <span class="ident">IntoIterator</span><span class="op"><</span><span class="ident">Item</span> <span class="op">=</span> <span class="ident">H</span><span class="op">></span>,
|
||||
<span class="ident">H</span>: <span class="ident">TryInto</span><span class="op"><</span><span class="ident">HeaderName</span><span class="op">></span>,
|
||||
@ -955,7 +991,7 @@
|
||||
{
|
||||
<span class="kw">for</span> <span class="ident">h</span> <span class="kw">in</span> <span class="ident">headers</span> {
|
||||
<span class="kw">match</span> <span class="ident">h</span>.<span class="ident">try_into</span>() {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">header</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">header</span>) => {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="kw">if</span> <span class="ident">cors</span>.<span class="ident">expose_headers</span>.<span class="ident">is_all</span>() {
|
||||
<span class="ident">cors</span>.<span class="ident">expose_headers</span> <span class="op">=</span> <span class="ident">AllOrSome::Some</span>(<span class="ident">HashSet::with_capacity</span>(<span class="number">8</span>));
|
||||
@ -965,7 +1001,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) => {
|
||||
<span class="self">self</span>.<span class="ident">error</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">Either::Left</span>(<span class="ident">err</span>.<span class="ident">into</span>()));
|
||||
<span class="kw">break</span>;
|
||||
}
|
||||
@ -982,7 +1018,7 @@
|
||||
<span class="doccomment">/// Pass a number (of seconds) or use None to disable sending max age header.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// [Fetch Standard CORS protocol]: https://fetch.spec.whatwg.org/#http-cors-protocol</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">max_age</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">max_age</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">usize</span><span class="op">></span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">max_age</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">max_age</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">usize</span><span class="op">></span><span class="op">></span>) -> <span class="ident">Cors</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="ident">cors</span>.<span class="ident">max_age</span> <span class="op">=</span> <span class="ident">max_age</span>.<span class="ident">into</span>()
|
||||
}
|
||||
@ -1001,7 +1037,7 @@
|
||||
<span class="doccomment">/// in an `CorsError::CredentialsWithWildcardOrigin` error during actix launch or runtime.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Defaults to `false`.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">send_wildcard</span>(<span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">send_wildcard</span>(<span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="ident">Cors</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="ident">cors</span>.<span class="ident">send_wildcard</span> <span class="op">=</span> <span class="bool-val">true</span>
|
||||
}
|
||||
@ -1024,7 +1060,7 @@
|
||||
<span class="doccomment">/// to send wildcards (`*`); this is not allowed by the CORS protocol.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// [Fetch Standard CORS protocol]: https://fetch.spec.whatwg.org/#http-cors-protocol</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">supports_credentials</span>(<span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">supports_credentials</span>(<span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="ident">Cors</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="ident">cors</span>.<span class="ident">supports_credentials</span> <span class="op">=</span> <span class="bool-val">true</span>
|
||||
}
|
||||
@ -1042,7 +1078,7 @@
|
||||
<span class="doccomment">/// informs CDNs and other caches that the CORS headers are dynamic, and cannot be cached.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// By default, `Vary` header support is enabled.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">disable_vary_header</span>(<span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">disable_vary_header</span>(<span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="ident">Cors</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="ident">cors</span>.<span class="ident">vary_header</span> <span class="op">=</span> <span class="bool-val">false</span>
|
||||
}
|
||||
@ -1056,7 +1092,7 @@
|
||||
<span class="doccomment">/// This is useful for application level middleware.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// By default *preflight* support is enabled.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">disable_preflight</span>(<span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">disable_preflight</span>(<span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="ident">Cors</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cors</span>) <span class="op">=</span> <span class="ident">cors</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">inner</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">error</span>) {
|
||||
<span class="ident">cors</span>.<span class="ident">preflight</span> <span class="op">=</span> <span class="bool-val">false</span>
|
||||
}
|
||||
@ -1070,7 +1106,7 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// *No* allowed origins, methods, request headers or exposed headers. Credentials</span>
|
||||
<span class="doccomment">/// not supported. No max age (will use browser's default).</span>
|
||||
<span class="kw">fn</span> <span class="ident">default</span>() <span class="op">-</span><span class="op">></span> <span class="ident">Cors</span> {
|
||||
<span class="kw">fn</span> <span class="ident">default</span>() -> <span class="ident">Cors</span> {
|
||||
<span class="kw">let</span> <span class="ident">inner</span> <span class="op">=</span> <span class="ident">Inner</span> {
|
||||
<span class="ident">allowed_origins</span>: <span class="ident">AllOrSome::Some</span>(<span class="ident">HashSet::with_capacity</span>(<span class="number">8</span>)),
|
||||
<span class="ident">allowed_origins_fns</span>: <span class="macro">smallvec!</span>[],
|
||||
@ -1098,10 +1134,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> <span class="ident">Transform</span><span class="op"><</span><span class="ident">S</span>, <span class="ident">ServiceRequest</span><span class="op">></span> <span class="kw">for</span> <span class="ident">Cors</span>
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">S</span>, <span class="ident">B</span><span class="op">></span> <span class="ident">Transform</span><span class="op"><</span><span class="ident">S</span>, <span class="ident">ServiceRequest</span><span class="op">></span> <span class="kw">for</span> <span class="ident">Cors</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">S</span>: <span class="ident">Service</span><span class="op"><</span><span class="ident">ServiceRequest</span>, <span class="ident">Response</span> <span class="op">=</span> <span class="ident">ServiceResponse</span>, <span class="ident">Error</span> <span class="op">=</span> <span class="ident">Error</span><span class="op">></span>,
|
||||
<span class="ident">S</span>: <span class="ident">Service</span><span class="op"><</span><span class="ident">ServiceRequest</span>, <span class="ident">Response</span> <span class="op">=</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>, <span class="ident">Error</span> <span class="op">=</span> <span class="ident">Error</span><span class="op">></span>,
|
||||
<span class="ident">S::Future</span>: <span class="lifetime">'static</span>,
|
||||
<span class="ident">B</span>: <span class="ident">MessageBody</span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">B::Error</span>: <span class="ident">StdError</span>,
|
||||
{
|
||||
<span class="kw">type</span> <span class="ident">Response</span> <span class="op">=</span> <span class="ident">ServiceResponse</span>;
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">Error</span>;
|
||||
@ -1109,11 +1147,11 @@
|
||||
<span class="kw">type</span> <span class="ident">Transform</span> <span class="op">=</span> <span class="ident">CorsMiddleware</span><span class="op"><</span><span class="ident">S</span><span class="op">></span>;
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Transform</span>, <span class="ident"><span class="self">Self</span>::InitError</span><span class="op">></span><span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">new_transform</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">service</span>: <span class="ident">S</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">new_transform</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">service</span>: <span class="ident">S</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="kw-2">ref</span> <span class="ident">err</span>) <span class="op">=</span> <span class="self">self</span>.<span class="ident">error</span> {
|
||||
<span class="kw">match</span> <span class="ident">err</span> {
|
||||
<span class="ident">Either::Left</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> <span class="macro">error!</span>(<span class="string">"{}"</span>, <span class="ident">err</span>),
|
||||
<span class="ident">Either::Right</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> <span class="macro">error!</span>(<span class="string">"{}"</span>, <span class="ident">err</span>),
|
||||
<span class="ident">Either::Left</span>(<span class="ident">err</span>) => <span class="macro">error!</span>(<span class="string">"{}"</span>, <span class="ident">err</span>),
|
||||
<span class="ident">Either::Right</span>(<span class="ident">err</span>) => <span class="macro">error!</span>(<span class="string">"{}"</span>, <span class="ident">err</span>),
|
||||
}
|
||||
|
||||
<span class="kw">return</span> <span class="ident">future::err</span>(());
|
||||
@ -1131,11 +1169,11 @@
|
||||
|
||||
<span class="comment">// bake allowed headers value if Some and not empty</span>
|
||||
<span class="kw">match</span> <span class="ident">inner</span>.<span class="ident">allowed_headers</span>.<span class="ident">as_ref</span>() {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">header_set</span>) <span class="kw">if</span> <span class="op">!</span><span class="ident">header_set</span>.<span class="ident">is_empty</span>() <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">header_set</span>) <span class="kw">if</span> <span class="op">!</span><span class="ident">header_set</span>.<span class="ident">is_empty</span>() => {
|
||||
<span class="kw">let</span> <span class="ident">allowed_headers_str</span> <span class="op">=</span> <span class="ident">intersperse_header_values</span>(<span class="ident">header_set</span>);
|
||||
<span class="ident">Rc::make_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">inner</span>).<span class="ident">allowed_headers_baked</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">allowed_headers_str</span>);
|
||||
}
|
||||
<span class="kw">_</span> <span class="op">=</span><span class="op">></span> {}
|
||||
<span class="kw">_</span> => {}
|
||||
}
|
||||
|
||||
<span class="comment">// bake allowed methods value if not empty</span>
|
||||
@ -1146,11 +1184,11 @@
|
||||
|
||||
<span class="comment">// bake exposed headers value if Some and not empty</span>
|
||||
<span class="kw">match</span> <span class="ident">inner</span>.<span class="ident">expose_headers</span>.<span class="ident">as_ref</span>() {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">header_set</span>) <span class="kw">if</span> <span class="op">!</span><span class="ident">header_set</span>.<span class="ident">is_empty</span>() <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">header_set</span>) <span class="kw">if</span> <span class="op">!</span><span class="ident">header_set</span>.<span class="ident">is_empty</span>() => {
|
||||
<span class="kw">let</span> <span class="ident">expose_headers_str</span> <span class="op">=</span> <span class="ident">intersperse_header_values</span>(<span class="ident">header_set</span>);
|
||||
<span class="ident">Rc::make_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">inner</span>).<span class="ident">expose_headers_baked</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">expose_headers_str</span>);
|
||||
}
|
||||
<span class="kw">_</span> <span class="op">=</span><span class="op">></span> {}
|
||||
<span class="kw">_</span> => {}
|
||||
}
|
||||
|
||||
<span class="ident">future::ok</span>(<span class="ident">CorsMiddleware</span> { <span class="ident">service</span>, <span class="ident">inner</span> })
|
||||
@ -1158,7 +1196,7 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Only call when values are guaranteed to be valid header values and set is not empty.</span>
|
||||
<span class="kw">fn</span> <span class="ident">intersperse_header_values</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="ident">val_set</span>: <span class="kw-2">&</span><span class="ident">HashSet</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">HeaderValue</span>
|
||||
<span class="kw">fn</span> <span class="ident">intersperse_header_values</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="ident">val_set</span>: <span class="kw-2">&</span><span class="ident">HashSet</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>) -> <span class="ident">HeaderValue</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">AsRef</span><span class="op"><</span><span class="ident">str</span><span class="op">></span>,
|
||||
{
|
||||
@ -1179,11 +1217,15 @@
|
||||
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
|
||||
<span class="kw">mod</span> <span class="ident">test</span> {
|
||||
<span class="kw">use</span> <span class="ident">std::convert</span>::{<span class="ident">Infallible</span>, <span class="ident">TryInto</span>};
|
||||
<span class="kw">use</span> <span class="ident">std::pin::Pin</span>;
|
||||
<span class="kw">use</span> <span class="ident">std::task</span>::{<span class="ident">Context</span>, <span class="ident">Poll</span>};
|
||||
|
||||
<span class="kw">use</span> <span class="ident">actix_web</span>::{
|
||||
<span class="ident">dev::Transform</span>,
|
||||
<span class="ident">body</span>::{<span class="ident">BodySize</span>, <span class="ident">MessageBody</span>},
|
||||
<span class="ident">dev</span>::{<span class="ident">fn_service</span>, <span class="ident">Transform</span>},
|
||||
<span class="ident">http</span>::{<span class="ident">HeaderName</span>, <span class="ident">StatusCode</span>},
|
||||
<span class="ident">test</span>::{<span class="self">self</span>, <span class="ident">TestRequest</span>},
|
||||
<span class="ident">web</span>::{<span class="ident">Bytes</span>, <span class="ident">HttpResponse</span>},
|
||||
};
|
||||
|
||||
<span class="kw">use</span> <span class="kw">super</span>::<span class="kw-2">*</span>;
|
||||
@ -1228,13 +1270,37 @@
|
||||
<span class="kw">impl</span> <span class="ident">TryInto</span><span class="op"><</span><span class="ident">HeaderName</span><span class="op">></span> <span class="kw">for</span> <span class="ident">ContentType</span> {
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">Infallible</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">try_into</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderName</span>, <span class="ident"><span class="self">Self</span>::Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">try_into</span>(<span class="self">self</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderName</span>, <span class="ident"><span class="self">Self</span>::Error</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">HeaderName::from_static</span>(<span class="string">"content-type"</span>))
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">let</span> <span class="ident">_cors</span> <span class="op">=</span> <span class="ident">Cors::default</span>().<span class="ident">allowed_header</span>(<span class="ident">ContentType</span>);
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">actix_rt::test</span>]</span>
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">middleware_generic_over_body_type</span>() {
|
||||
<span class="kw">struct</span> <span class="ident">Foo</span>;
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">MessageBody</span> <span class="kw">for</span> <span class="ident">Foo</span> {
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">std::io::Error</span>;
|
||||
<span class="kw">fn</span> <span class="ident">size</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">BodySize</span> {
|
||||
<span class="ident">BodySize::None</span>
|
||||
}
|
||||
<span class="kw">fn</span> <span class="ident">poll_next</span>(
|
||||
<span class="self">self</span>: <span class="ident">Pin</span><span class="op"><</span><span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">Self</span><span class="op">></span>,
|
||||
<span class="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Context</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>,
|
||||
) -> <span class="ident">Poll</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">Bytes</span>, <span class="ident"><span class="self">Self</span>::Error</span><span class="op">></span><span class="op">></span><span class="op">></span> {
|
||||
<span class="ident">Poll::Ready</span>(<span class="prelude-val">None</span>)
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">let</span> <span class="ident">srv</span> <span class="op">=</span> <span class="ident">fn_service</span>(<span class="op">|</span><span class="ident">req</span>: <span class="ident">ServiceRequest</span><span class="op">|</span> <span class="kw">async</span> <span class="kw">move</span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">req</span>.<span class="ident">into_response</span>(<span class="ident">HttpResponse::Ok</span>().<span class="ident">message_body</span>(<span class="ident">Foo</span>)<span class="question-mark">?</span>))
|
||||
});
|
||||
|
||||
<span class="ident">Cors::default</span>().<span class="ident">new_transform</span>(<span class="ident">srv</span>).<span class="kw">await</span>.<span class="ident">unwrap</span>();
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_cors" data-search-index-js="../../search-index.js" data-search-js="../../search.js"></div>
|
||||
|
@ -90,11 +90,11 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">ResponseError</span> <span class="kw">for</span> <span class="ident">CorsError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">status_code</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">StatusCode</span> {
|
||||
<span class="kw">fn</span> <span class="ident">status_code</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">StatusCode</span> {
|
||||
<span class="ident">StatusCode::BAD_REQUEST</span>
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">error_response</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">HttpResponse</span> {
|
||||
<span class="kw">fn</span> <span class="ident">error_response</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">HttpResponse</span> {
|
||||
<span class="ident">HttpResponse::with_body</span>(<span class="ident">StatusCode::BAD_REQUEST</span>, <span class="self">self</span>.<span class="ident">to_string</span>().<span class="ident">into</span>())
|
||||
}
|
||||
}
|
||||
|
@ -342,25 +342,25 @@
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Clone</span>)]</span>
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct</span> <span class="ident">OriginFn</span> {
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="ident">boxed_fn</span>: <span class="ident">Rc</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">Fn</span>(<span class="kw-2">&</span><span class="ident">HeaderValue</span>, <span class="kw-2">&</span><span class="ident">RequestHead</span>) <span class="op">-</span><span class="op">></span> <span class="ident">bool</span><span class="op">></span>,
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="ident">boxed_fn</span>: <span class="ident">Rc</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">Fn</span>(<span class="kw-2">&</span><span class="ident">HeaderValue</span>, <span class="kw-2">&</span><span class="ident">RequestHead</span>) -> <span class="ident">bool</span><span class="op">></span>,
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Default</span> <span class="kw">for</span> <span class="ident">OriginFn</span> {
|
||||
<span class="doccomment">/// Dummy default for use in tiny_vec. Do not use.</span>
|
||||
<span class="kw">fn</span> <span class="ident">default</span>() <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">let</span> <span class="ident">boxed_fn</span>: <span class="ident">Rc</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">Fn</span>(<span class="kw-2">&</span><span class="kw">_</span>, <span class="kw-2">&</span><span class="kw">_</span>) <span class="op">-</span><span class="op">></span> <span class="kw">_</span><span class="op">></span> <span class="op">=</span> <span class="ident">Rc::new</span>(<span class="op">|</span><span class="ident">_origin</span>, <span class="ident">_req_head</span><span class="op">|</span> <span class="bool-val">false</span>);
|
||||
<span class="kw">fn</span> <span class="ident">default</span>() -> <span class="self">Self</span> {
|
||||
<span class="kw">let</span> <span class="ident">boxed_fn</span>: <span class="ident">Rc</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">Fn</span>(<span class="kw-2">&</span><span class="kw">_</span>, <span class="kw-2">&</span><span class="kw">_</span>) -> <span class="kw">_</span><span class="op">></span> <span class="op">=</span> <span class="ident">Rc::new</span>(<span class="op">|</span><span class="ident">_origin</span>, <span class="ident">_req_head</span><span class="op">|</span> <span class="bool-val">false</span>);
|
||||
<span class="self">Self</span> { <span class="ident">boxed_fn</span> }
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">fmt::Debug</span> <span class="kw">for</span> <span class="ident">OriginFn</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="ident">f</span>.<span class="ident">write_str</span>(<span class="string">"origin_fn"</span>)
|
||||
}
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Try to parse header value as HTTP method.</span>
|
||||
<span class="kw">fn</span> <span class="ident">header_value_try_into_method</span>(<span class="ident">hdr</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Method</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">header_value_try_into_method</span>(<span class="ident">hdr</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Method</span><span class="op">></span> {
|
||||
<span class="ident">hdr</span>.<span class="ident">to_str</span>()
|
||||
.<span class="ident">ok</span>()
|
||||
.<span class="ident">and_then</span>(<span class="op">|</span><span class="ident">meth</span><span class="op">|</span> <span class="ident">Method::try_from</span>(<span class="ident">meth</span>).<span class="ident">ok</span>())
|
||||
@ -391,20 +391,20 @@
|
||||
<span class="kw">static</span> <span class="ident">EMPTY_ORIGIN_SET</span>: <span class="ident">Lazy</span><span class="op"><</span><span class="ident">HashSet</span><span class="op"><</span><span class="ident">HeaderValue</span><span class="op">></span><span class="op">></span> <span class="op">=</span> <span class="ident">Lazy::new</span>(<span class="ident">HashSet::new</span>);
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Inner</span> {
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">validate_origin</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">RequestHead</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">CorsError</span><span class="op">></span> {
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">validate_origin</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">RequestHead</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">CorsError</span><span class="op">></span> {
|
||||
<span class="comment">// return early if all origins are allowed or get ref to allowed origins set</span>
|
||||
<span class="attribute">#[<span class="ident">allow</span>(<span class="ident">clippy::mutable_key_type</span>)]</span>
|
||||
<span class="kw">let</span> <span class="ident">allowed_origins</span> <span class="op">=</span> <span class="kw">match</span> <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">allowed_origins</span> {
|
||||
<span class="ident">AllOrSome::All</span> <span class="kw">if</span> <span class="self">self</span>.<span class="ident">allowed_origins_fns</span>.<span class="ident">is_empty</span>() <span class="op">=</span><span class="op">></span> <span class="kw">return</span> <span class="prelude-val">Ok</span>(()),
|
||||
<span class="ident">AllOrSome::Some</span>(<span class="ident">allowed_origins</span>) <span class="op">=</span><span class="op">></span> <span class="ident">allowed_origins</span>,
|
||||
<span class="ident">AllOrSome::All</span> <span class="kw">if</span> <span class="self">self</span>.<span class="ident">allowed_origins_fns</span>.<span class="ident">is_empty</span>() => <span class="kw">return</span> <span class="prelude-val">Ok</span>(()),
|
||||
<span class="ident">AllOrSome::Some</span>(<span class="ident">allowed_origins</span>) => <span class="ident">allowed_origins</span>,
|
||||
<span class="comment">// only function origin validators are defined</span>
|
||||
<span class="kw">_</span> <span class="op">=</span><span class="op">></span> <span class="kw-2">&</span><span class="ident">EMPTY_ORIGIN_SET</span>,
|
||||
<span class="kw">_</span> => <span class="kw-2">&</span><span class="ident">EMPTY_ORIGIN_SET</span>,
|
||||
};
|
||||
|
||||
<span class="comment">// get origin header and try to parse as string</span>
|
||||
<span class="kw">match</span> <span class="ident">req</span>.<span class="ident">headers</span>().<span class="ident">get</span>(<span class="ident">header::ORIGIN</span>) {
|
||||
<span class="comment">// origin header exists and is a string</span>
|
||||
<span class="prelude-val">Some</span>(<span class="ident">origin</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">origin</span>) => {
|
||||
<span class="kw">if</span> <span class="ident">allowed_origins</span>.<span class="ident">contains</span>(<span class="ident">origin</span>) <span class="op">|</span><span class="op">|</span> <span class="self">self</span>.<span class="ident">validate_origin_fns</span>(<span class="ident">origin</span>, <span class="ident">req</span>) {
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
} <span class="kw">else</span> {
|
||||
@ -415,23 +415,23 @@
|
||||
<span class="comment">// origin header is missing</span>
|
||||
<span class="comment">// note: with our implementation, the origin header is required for OPTIONS request or</span>
|
||||
<span class="comment">// else this would be unreachable</span>
|
||||
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">Err</span>(<span class="ident">CorsError::MissingOrigin</span>),
|
||||
<span class="prelude-val">None</span> => <span class="prelude-val">Err</span>(<span class="ident">CorsError::MissingOrigin</span>),
|
||||
}
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Accepts origin if _ANY_ functions return true. Only called when Origin exists.</span>
|
||||
<span class="kw">fn</span> <span class="ident">validate_origin_fns</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">origin</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">RequestHead</span>) <span class="op">-</span><span class="op">></span> <span class="ident">bool</span> {
|
||||
<span class="kw">fn</span> <span class="ident">validate_origin_fns</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">origin</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">RequestHead</span>) -> <span class="ident">bool</span> {
|
||||
<span class="self">self</span>.<span class="ident">allowed_origins_fns</span>
|
||||
.<span class="ident">iter</span>()
|
||||
.<span class="ident">any</span>(<span class="op">|</span><span class="ident">origin_fn</span><span class="op">|</span> (<span class="ident">origin_fn</span>.<span class="ident">boxed_fn</span>)(<span class="ident">origin</span>, <span class="ident">req</span>))
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Only called if origin exists and always after it's validated.</span>
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">access_control_allow_origin</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">RequestHead</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">HeaderValue</span><span class="op">></span> {
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">access_control_allow_origin</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">RequestHead</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">HeaderValue</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">origin</span> <span class="op">=</span> <span class="ident">req</span>.<span class="ident">headers</span>().<span class="ident">get</span>(<span class="ident">header::ORIGIN</span>);
|
||||
|
||||
<span class="kw">match</span> <span class="self">self</span>.<span class="ident">allowed_origins</span> {
|
||||
<span class="ident">AllOrSome::All</span> <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">AllOrSome::All</span> => {
|
||||
<span class="kw">if</span> <span class="self">self</span>.<span class="ident">send_wildcard</span> {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">HeaderValue::from_static</span>(<span class="string">"*"</span>))
|
||||
} <span class="kw">else</span> {
|
||||
@ -440,7 +440,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
<span class="ident">AllOrSome::Some</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">AllOrSome::Some</span>(<span class="kw">_</span>) => {
|
||||
<span class="comment">// since origin (if it exists) is known to be allowed if this method is called</span>
|
||||
<span class="comment">// then cloning the option is all that is required to be used as an echoed back</span>
|
||||
<span class="comment">// header value (or omitted if None)</span>
|
||||
@ -451,7 +451,7 @@
|
||||
|
||||
<span class="doccomment">/// Use in preflight checks and therefore operates on header list in</span>
|
||||
<span class="doccomment">/// `Access-Control-Request-Headers` not the actual header set.</span>
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">validate_allowed_method</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">RequestHead</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">CorsError</span><span class="op">></span> {
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">validate_allowed_method</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">RequestHead</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">CorsError</span><span class="op">></span> {
|
||||
<span class="comment">// extract access control header and try to parse as method</span>
|
||||
<span class="kw">let</span> <span class="ident">request_method</span> <span class="op">=</span> <span class="ident">req</span>
|
||||
.<span class="ident">headers</span>()
|
||||
@ -460,25 +460,25 @@
|
||||
|
||||
<span class="kw">match</span> <span class="ident">request_method</span> {
|
||||
<span class="comment">// method valid and allowed</span>
|
||||
<span class="prelude-val">Some</span>(<span class="prelude-val">Some</span>(<span class="ident">method</span>)) <span class="kw">if</span> <span class="self">self</span>.<span class="ident">allowed_methods</span>.<span class="ident">contains</span>(<span class="kw-2">&</span><span class="ident">method</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(()),
|
||||
<span class="prelude-val">Some</span>(<span class="prelude-val">Some</span>(<span class="ident">method</span>)) <span class="kw">if</span> <span class="self">self</span>.<span class="ident">allowed_methods</span>.<span class="ident">contains</span>(<span class="kw-2">&</span><span class="ident">method</span>) => <span class="prelude-val">Ok</span>(()),
|
||||
|
||||
<span class="comment">// method valid but not allowed</span>
|
||||
<span class="prelude-val">Some</span>(<span class="prelude-val">Some</span>(<span class="kw">_</span>)) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Err</span>(<span class="ident">CorsError::MethodNotAllowed</span>),
|
||||
<span class="prelude-val">Some</span>(<span class="prelude-val">Some</span>(<span class="kw">_</span>)) => <span class="prelude-val">Err</span>(<span class="ident">CorsError::MethodNotAllowed</span>),
|
||||
|
||||
<span class="comment">// method invalid</span>
|
||||
<span class="prelude-val">Some</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Err</span>(<span class="ident">CorsError::BadRequestMethod</span>),
|
||||
<span class="prelude-val">Some</span>(<span class="kw">_</span>) => <span class="prelude-val">Err</span>(<span class="ident">CorsError::BadRequestMethod</span>),
|
||||
|
||||
<span class="comment">// method missing</span>
|
||||
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">Err</span>(<span class="ident">CorsError::MissingRequestMethod</span>),
|
||||
<span class="prelude-val">None</span> => <span class="prelude-val">Err</span>(<span class="ident">CorsError::MissingRequestMethod</span>),
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">validate_allowed_headers</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">RequestHead</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">CorsError</span><span class="op">></span> {
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">validate_allowed_headers</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">RequestHead</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">CorsError</span><span class="op">></span> {
|
||||
<span class="comment">// return early if all headers are allowed or get ref to allowed origins set</span>
|
||||
<span class="attribute">#[<span class="ident">allow</span>(<span class="ident">clippy::mutable_key_type</span>)]</span>
|
||||
<span class="kw">let</span> <span class="ident">allowed_headers</span> <span class="op">=</span> <span class="kw">match</span> <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">allowed_headers</span> {
|
||||
<span class="ident">AllOrSome::All</span> <span class="op">=</span><span class="op">></span> <span class="kw">return</span> <span class="prelude-val">Ok</span>(()),
|
||||
<span class="ident">AllOrSome::Some</span>(<span class="ident">allowed_headers</span>) <span class="op">=</span><span class="op">></span> <span class="ident">allowed_headers</span>,
|
||||
<span class="ident">AllOrSome::All</span> => <span class="kw">return</span> <span class="prelude-val">Ok</span>(()),
|
||||
<span class="ident">AllOrSome::Some</span>(<span class="ident">allowed_headers</span>) => <span class="ident">allowed_headers</span>,
|
||||
};
|
||||
|
||||
<span class="comment">// extract access control header as string</span>
|
||||
@ -490,7 +490,7 @@
|
||||
|
||||
<span class="kw">match</span> <span class="ident">request_headers</span> {
|
||||
<span class="comment">// header list is valid string</span>
|
||||
<span class="prelude-val">Some</span>(<span class="prelude-val">Ok</span>(<span class="ident">headers</span>)) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Some</span>(<span class="prelude-val">Ok</span>(<span class="ident">headers</span>)) => {
|
||||
<span class="comment">// the set is ephemeral we take care not to mutate the</span>
|
||||
<span class="comment">// inserted keys so this lint exception is acceptable</span>
|
||||
<span class="attribute">#[<span class="ident">allow</span>(<span class="ident">clippy::mutable_key_type</span>)]</span>
|
||||
@ -499,8 +499,8 @@
|
||||
<span class="comment">// try to convert each header name in the comma-separated list</span>
|
||||
<span class="kw">for</span> <span class="ident">hdr</span> <span class="kw">in</span> <span class="ident">headers</span>.<span class="ident">split</span>(<span class="string">','</span>) {
|
||||
<span class="kw">match</span> <span class="ident">hdr</span>.<span class="ident">trim</span>().<span class="ident">try_into</span>() {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">hdr</span>) <span class="op">=</span><span class="op">></span> <span class="ident">request_headers</span>.<span class="ident">insert</span>(<span class="ident">hdr</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></span> <span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">CorsError::BadRequestHeaders</span>),
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">hdr</span>) => <span class="ident">request_headers</span>.<span class="ident">insert</span>(<span class="ident">hdr</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">CorsError::BadRequestHeaders</span>),
|
||||
};
|
||||
}
|
||||
|
||||
@ -518,10 +518,10 @@
|
||||
}
|
||||
|
||||
<span class="comment">// header list is not a string</span>
|
||||
<span class="prelude-val">Some</span>(<span class="prelude-val">Err</span>(<span class="kw">_</span>)) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Err</span>(<span class="ident">CorsError::BadRequestHeaders</span>),
|
||||
<span class="prelude-val">Some</span>(<span class="prelude-val">Err</span>(<span class="kw">_</span>)) => <span class="prelude-val">Err</span>(<span class="ident">CorsError::BadRequestHeaders</span>),
|
||||
|
||||
<span class="comment">// header list missing</span>
|
||||
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(()),
|
||||
<span class="prelude-val">None</span> => <span class="prelude-val">Ok</span>(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -538,7 +538,7 @@
|
||||
|
||||
<span class="kw">use</span> <span class="ident"><span class="kw">crate</span>::Cors</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">val_as_str</span>(<span class="ident">val</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="ident">str</span> {
|
||||
<span class="kw">fn</span> <span class="ident">val_as_str</span>(<span class="ident">val</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>) -> <span class="kw-2">&</span><span class="ident">str</span> {
|
||||
<span class="ident">val</span>.<span class="ident">to_str</span>().<span class="ident">unwrap</span>()
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,7 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> <span class="ident">CorsMiddleware</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">handle_preflight</span>(<span class="ident">inner</span>: <span class="kw-2">&</span><span class="ident">Inner</span>, <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident">ServiceResponse</span> {
|
||||
<span class="kw">fn</span> <span class="ident">handle_preflight</span>(<span class="ident">inner</span>: <span class="kw-2">&</span><span class="ident">Inner</span>, <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) -> <span class="ident">ServiceResponse</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span> <span class="ident">inner</span>
|
||||
.<span class="ident">validate_origin</span>(<span class="ident">req</span>.<span class="ident">head</span>())
|
||||
.<span class="ident">and_then</span>(<span class="op">|</span><span class="kw">_</span><span class="op">|</span> <span class="ident">inner</span>.<span class="ident">validate_allowed_method</span>(<span class="ident">req</span>.<span class="ident">head</span>()))
|
||||
@ -285,7 +285,7 @@
|
||||
<span class="ident">req</span>.<span class="ident">into_response</span>(<span class="ident">res</span>)
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">augment_response</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>(<span class="ident">inner</span>: <span class="kw-2">&</span><span class="ident">Inner</span>, <span class="kw-2">mut</span> <span class="ident">res</span>: <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">augment_response</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>(<span class="ident">inner</span>: <span class="kw-2">&</span><span class="ident">Inner</span>, <span class="kw-2">mut</span> <span class="ident">res</span>: <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>) -> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">origin</span>) <span class="op">=</span> <span class="ident">inner</span>.<span class="ident">access_control_allow_origin</span>(<span class="ident">res</span>.<span class="ident">request</span>().<span class="ident">head</span>()) {
|
||||
<span class="ident">res</span>.<span class="ident">headers_mut</span>()
|
||||
.<span class="ident">insert</span>(<span class="ident">header::ACCESS_CONTROL_ALLOW_ORIGIN</span>, <span class="ident">origin</span>);
|
||||
@ -305,13 +305,13 @@
|
||||
|
||||
<span class="kw">if</span> <span class="ident">inner</span>.<span class="ident">vary_header</span> {
|
||||
<span class="kw">let</span> <span class="ident">value</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">res</span>.<span class="ident">headers_mut</span>().<span class="ident">get</span>(<span class="ident">header::VARY</span>) {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">hdr</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">hdr</span>) => {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">val</span>: <span class="ident">Vec</span><span class="op"><</span><span class="ident">u8</span><span class="op">></span> <span class="op">=</span> <span class="ident">Vec::with_capacity</span>(<span class="ident">hdr</span>.<span class="ident">len</span>() <span class="op">+</span> <span class="number">8</span>);
|
||||
<span class="ident">val</span>.<span class="ident">extend</span>(<span class="ident">hdr</span>.<span class="ident">as_bytes</span>());
|
||||
<span class="ident">val</span>.<span class="ident">extend</span>(<span class="string">b", Origin"</span>);
|
||||
<span class="ident">val</span>.<span class="ident">try_into</span>().<span class="ident">unwrap</span>()
|
||||
}
|
||||
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">></span> <span class="ident">HeaderValue::from_static</span>(<span class="string">"Origin"</span>),
|
||||
<span class="prelude-val">None</span> => <span class="ident">HeaderValue::from_static</span>(<span class="string">"Origin"</span>),
|
||||
};
|
||||
|
||||
<span class="ident">res</span>.<span class="ident">headers_mut</span>().<span class="ident">insert</span>(<span class="ident">header::VARY</span>, <span class="ident">value</span>);
|
||||
@ -339,8 +339,8 @@
|
||||
|
||||
<span class="macro">actix_service::forward_ready!</span>(<span class="ident">service</span>);
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">if</span> <span class="self">self</span>.<span class="ident">inner</span>.<span class="ident">preflight</span> <span class="op">&&</span> <span class="ident">req</span>.<span class="ident">method</span>() <span class="op">=</span><span class="op">=</span> <span class="ident">Method::OPTIONS</span> {
|
||||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">if</span> <span class="self">self</span>.<span class="ident">inner</span>.<span class="ident">preflight</span> <span class="op">&&</span> <span class="ident">req</span>.<span class="ident">method</span>() <span class="op">==</span> <span class="ident">Method::OPTIONS</span> {
|
||||
<span class="kw">let</span> <span class="ident">inner</span> <span class="op">=</span> <span class="ident">Rc::clone</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">inner</span>);
|
||||
<span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident"><span class="self">Self</span>::handle_preflight</span>(<span class="kw-2">&</span><span class="ident">inner</span>, <span class="ident">req</span>);
|
||||
<span class="ident">Either::Left</span>(<span class="ident">ok</span>(<span class="ident">res</span>))
|
||||
|
@ -867,7 +867,7 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">CookieIdentityInner</span> {
|
||||
<span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>]) <span class="op">-</span><span class="op">></span> <span class="ident">CookieIdentityInner</span> {
|
||||
<span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>]) -> <span class="ident">CookieIdentityInner</span> {
|
||||
<span class="kw">let</span> <span class="ident">key_v2</span>: <span class="ident">Vec</span><span class="op"><</span><span class="ident">u8</span><span class="op">></span> <span class="op">=</span> [<span class="ident">key</span>, <span class="kw-2">&</span>[<span class="number">1</span>, <span class="number">0</span>, <span class="number">0</span>, <span class="number">0</span>]].<span class="ident">concat</span>();
|
||||
|
||||
<span class="ident">CookieIdentityInner</span> {
|
||||
@ -889,7 +889,7 @@
|
||||
<span class="kw-2">&</span><span class="self">self</span>,
|
||||
<span class="ident">resp</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>,
|
||||
<span class="ident">value</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">CookieValue</span><span class="op">></span>,
|
||||
) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>()<span class="op">></span> {
|
||||
) -> <span class="prelude-ty">Result</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">add_cookie</span> <span class="op">=</span> <span class="ident">value</span>.<span class="ident">is_some</span>();
|
||||
<span class="kw">let</span> <span class="ident">val</span> <span class="op">=</span> <span class="ident">value</span>
|
||||
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">val</span><span class="op">|</span> {
|
||||
@ -945,7 +945,7 @@
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">load</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">CookieValue</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">load</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">ServiceRequest</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">CookieValue</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">cookie</span> <span class="op">=</span> <span class="ident">req</span>.<span class="ident">cookie</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">name</span>)<span class="question-mark">?</span>;
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">jar</span> <span class="op">=</span> <span class="ident">CookieJar::new</span>();
|
||||
<span class="ident">jar</span>.<span class="ident">add_original</span>(<span class="ident">cookie</span>.<span class="ident">clone</span>());
|
||||
@ -969,7 +969,7 @@
|
||||
})
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">cookie</span>: <span class="ident">Cookie</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">CookieValue</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">cookie</span>: <span class="ident">Cookie</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">CookieValue</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">value</span>: <span class="ident">CookieValue</span> <span class="op">=</span> <span class="ident">serde_json::from_str</span>(<span class="ident">cookie</span>.<span class="ident">value</span>()).<span class="ident">ok</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">let</span> <span class="ident">now</span> <span class="op">=</span> <span class="ident">SystemTime::now</span>();
|
||||
|
||||
@ -992,15 +992,15 @@
|
||||
<span class="prelude-val">Some</span>(<span class="ident">value</span>)
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">legacy_supported</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">bool</span> {
|
||||
<span class="kw">fn</span> <span class="ident">legacy_supported</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">bool</span> {
|
||||
<span class="self">self</span>.<span class="ident">visit_deadline</span>.<span class="ident">is_none</span>() <span class="op">&&</span> <span class="self">self</span>.<span class="ident">login_deadline</span>.<span class="ident">is_none</span>()
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">always_update_cookie</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">bool</span> {
|
||||
<span class="kw">fn</span> <span class="ident">always_update_cookie</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">bool</span> {
|
||||
<span class="self">self</span>.<span class="ident">visit_deadline</span>.<span class="ident">is_some</span>()
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">requires_oob_data</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">bool</span> {
|
||||
<span class="kw">fn</span> <span class="ident">requires_oob_data</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">bool</span> {
|
||||
<span class="self">self</span>.<span class="ident">login_deadline</span>.<span class="ident">is_some</span>()
|
||||
}
|
||||
}
|
||||
@ -1037,49 +1037,49 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// # Panics</span>
|
||||
<span class="doccomment">/// Panics if `key` is less than 32 bytes in length..</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>]) <span class="op">-</span><span class="op">></span> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>]) -> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="ident">CookieIdentityPolicy</span>(<span class="ident">Rc::new</span>(<span class="ident">CookieIdentityInner::new</span>(<span class="ident">key</span>)))
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the name of issued cookies.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">name</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">name</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>) -> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="self">self</span>.<span class="ident">inner_mut</span>().<span class="ident">name</span> <span class="op">=</span> <span class="ident">value</span>.<span class="ident">into</span>();
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `Path` attribute of issued cookies.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">path</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">path</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>) -> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="self">self</span>.<span class="ident">inner_mut</span>().<span class="ident">path</span> <span class="op">=</span> <span class="ident">value</span>.<span class="ident">into</span>();
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `Domain` attribute of issued cookies.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">domain</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">domain</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>) -> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="self">self</span>.<span class="ident">inner_mut</span>().<span class="ident">domain</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">value</span>.<span class="ident">into</span>());
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `Secure` attribute of issued cookies.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">secure</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">bool</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">secure</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">bool</span>) -> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="self">self</span>.<span class="ident">inner_mut</span>().<span class="ident">secure</span> <span class="op">=</span> <span class="ident">value</span>;
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `Max-Age` attribute of issued cookies.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">max_age</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">Duration</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">max_age</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">Duration</span>) -> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="self">self</span>.<span class="ident">inner_mut</span>().<span class="ident">max_age</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">value</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `Max-Age` attribute of issued cookies with given number of seconds.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">max_age_secs</span>(<span class="self">self</span>, <span class="ident">seconds</span>: <span class="ident">i64</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">max_age_secs</span>(<span class="self">self</span>, <span class="ident">seconds</span>: <span class="ident">i64</span>) -> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="self">self</span>.<span class="ident">max_age</span>(<span class="ident">Duration::seconds</span>(<span class="ident">seconds</span>))
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `HttpOnly` attribute of issued cookies.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// By default, the `HttpOnly` attribute is omitted from issued cookies.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">http_only</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">http_only</span>: <span class="ident">bool</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">http_only</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">http_only</span>: <span class="ident">bool</span>) -> <span class="self">Self</span> {
|
||||
<span class="self">self</span>.<span class="ident">inner_mut</span>().<span class="ident">http_only</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">http_only</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -1087,7 +1087,7 @@
|
||||
<span class="doccomment">/// Sets the `SameSite` attribute of issued cookies.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// By default, the `SameSite` attribute is omitted from issued cookies.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">same_site</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">same_site</span>: <span class="ident">SameSite</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">same_site</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">same_site</span>: <span class="ident">SameSite</span>) -> <span class="self">Self</span> {
|
||||
<span class="self">self</span>.<span class="ident">inner_mut</span>().<span class="ident">same_site</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">same_site</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -1099,7 +1099,7 @@
|
||||
<span class="doccomment">/// visitation timestamp.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// By default, visit deadline is disabled.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">visit_deadline</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">deadline</span>: <span class="ident">Duration</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">visit_deadline</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">deadline</span>: <span class="ident">Duration</span>) -> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="self">self</span>.<span class="ident">inner_mut</span>().<span class="ident">visit_deadline</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">deadline</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -1112,12 +1112,12 @@
|
||||
<span class="doccomment">/// into the issued cookies, making it immutable to users.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// By default, login deadline is disabled.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">login_deadline</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">deadline</span>: <span class="ident">Duration</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">login_deadline</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">deadline</span>: <span class="ident">Duration</span>) -> <span class="ident">CookieIdentityPolicy</span> {
|
||||
<span class="self">self</span>.<span class="ident">inner_mut</span>().<span class="ident">login_deadline</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">deadline</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">inner_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">CookieIdentityInner</span> {
|
||||
<span class="kw">fn</span> <span class="ident">inner_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">CookieIdentityInner</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>()
|
||||
}
|
||||
}
|
||||
@ -1126,7 +1126,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>, <span class="ident">Error</span><span class="op">></span><span class="op">></span>;
|
||||
<span class="kw">type</span> <span class="ident">ResponseFuture</span> <span class="op">=</span> <span class="ident">Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span><span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">from_request</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from_request</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceRequest</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="ident">ready</span>(<span class="prelude-val">Ok</span>(<span class="self">self</span>.<span class="number">0</span>.<span class="ident">load</span>(<span class="ident">req</span>).<span class="ident">map</span>(<span class="op">|</span><span class="ident">value</span><span class="op">|</span> {
|
||||
<span class="kw">let</span> <span class="ident">CookieValue</span> {
|
||||
<span class="ident">identity</span>,
|
||||
@ -1148,7 +1148,7 @@
|
||||
<span class="ident">id</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>,
|
||||
<span class="ident">changed</span>: <span class="ident">bool</span>,
|
||||
<span class="ident">res</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>,
|
||||
) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::ResponseFuture</span> {
|
||||
) -> <span class="ident"><span class="self">Self</span>::ResponseFuture</span> {
|
||||
<span class="kw">let</span> <span class="kw">_</span> <span class="op">=</span> <span class="kw">if</span> <span class="ident">changed</span> {
|
||||
<span class="kw">let</span> <span class="ident">login_timestamp</span> <span class="op">=</span> <span class="ident">SystemTime::now</span>();
|
||||
|
||||
@ -1208,7 +1208,7 @@
|
||||
<span class="ident">identity</span>: <span class="kw-2">&</span><span class="lifetime">'static</span> <span class="ident">str</span>,
|
||||
<span class="ident">login_timestamp</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">SystemTime</span><span class="op">></span>,
|
||||
<span class="ident">visit_timestamp</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">SystemTime</span><span class="op">></span>,
|
||||
) <span class="op">-</span><span class="op">></span> <span class="ident">Cookie</span><span class="op"><</span><span class="lifetime">'static</span><span class="op">></span> {
|
||||
) -> <span class="ident">Cookie</span><span class="op"><</span><span class="lifetime">'static</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">jar</span> <span class="op">=</span> <span class="ident">CookieJar::new</span>();
|
||||
<span class="kw">let</span> <span class="ident">key</span>: <span class="ident">Vec</span><span class="op"><</span><span class="ident">u8</span><span class="op">></span> <span class="op">=</span> <span class="ident">COOKIE_KEY_MASTER</span>
|
||||
.<span class="ident">iter</span>()
|
||||
@ -1259,18 +1259,18 @@
|
||||
<span class="kw">let</span> <span class="ident">t30sec_ago</span> <span class="op">=</span> <span class="ident">now</span> <span class="op">-</span> <span class="ident">Duration::seconds</span>(<span class="number">30</span>);
|
||||
|
||||
<span class="kw">match</span> <span class="ident">login_timestamp</span> {
|
||||
<span class="ident">LoginTimestampCheck::NoTimestamp</span> <span class="op">=</span><span class="op">></span> <span class="macro">assert_eq!</span>(<span class="ident">cv</span>.<span class="ident">login_timestamp</span>, <span class="prelude-val">None</span>),
|
||||
<span class="ident">LoginTimestampCheck::NewTimestamp</span> <span class="op">=</span><span class="op">></span> <span class="macro">assert!</span>(
|
||||
<span class="ident">LoginTimestampCheck::NoTimestamp</span> => <span class="macro">assert_eq!</span>(<span class="ident">cv</span>.<span class="ident">login_timestamp</span>, <span class="prelude-val">None</span>),
|
||||
<span class="ident">LoginTimestampCheck::NewTimestamp</span> => <span class="macro">assert!</span>(
|
||||
<span class="ident">t30sec_ago</span> <span class="op"><</span><span class="op">=</span> <span class="ident">cv</span>.<span class="ident">login_timestamp</span>.<span class="ident">unwrap</span>() <span class="op">&&</span> <span class="ident">cv</span>.<span class="ident">login_timestamp</span>.<span class="ident">unwrap</span>() <span class="op"><</span><span class="op">=</span> <span class="ident">now</span>
|
||||
),
|
||||
<span class="ident">LoginTimestampCheck::OldTimestamp</span>(<span class="ident">old_timestamp</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">LoginTimestampCheck::OldTimestamp</span>(<span class="ident">old_timestamp</span>) => {
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">cv</span>.<span class="ident">login_timestamp</span>, <span class="prelude-val">Some</span>(<span class="ident">old_timestamp</span>))
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">match</span> <span class="ident">visit_timestamp</span> {
|
||||
<span class="ident">VisitTimeStampCheck::NoTimestamp</span> <span class="op">=</span><span class="op">></span> <span class="macro">assert_eq!</span>(<span class="ident">cv</span>.<span class="ident">visit_timestamp</span>, <span class="prelude-val">None</span>),
|
||||
<span class="ident">VisitTimeStampCheck::NewTimestamp</span> <span class="op">=</span><span class="op">></span> <span class="macro">assert!</span>(
|
||||
<span class="ident">VisitTimeStampCheck::NoTimestamp</span> => <span class="macro">assert_eq!</span>(<span class="ident">cv</span>.<span class="ident">visit_timestamp</span>, <span class="prelude-val">None</span>),
|
||||
<span class="ident">VisitTimeStampCheck::NewTimestamp</span> => <span class="macro">assert!</span>(
|
||||
<span class="ident">t30sec_ago</span> <span class="op"><</span><span class="op">=</span> <span class="ident">cv</span>.<span class="ident">visit_timestamp</span>.<span class="ident">unwrap</span>() <span class="op">&&</span> <span class="ident">cv</span>.<span class="ident">visit_timestamp</span>.<span class="ident">unwrap</span>() <span class="op"><</span><span class="op">=</span> <span class="ident">now</span>
|
||||
),
|
||||
}
|
||||
@ -1392,7 +1392,7 @@
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">SameSite::None</span>, <span class="ident">c</span>.<span class="ident">same_site</span>().<span class="ident">unwrap</span>());
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">legacy_login_cookie</span>(<span class="ident">identity</span>: <span class="kw-2">&</span><span class="lifetime">'static</span> <span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Cookie</span><span class="op"><</span><span class="lifetime">'static</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">legacy_login_cookie</span>(<span class="ident">identity</span>: <span class="kw-2">&</span><span class="lifetime">'static</span> <span class="ident">str</span>) -> <span class="ident">Cookie</span><span class="op"><</span><span class="lifetime">'static</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">jar</span> <span class="op">=</span> <span class="ident">CookieJar::new</span>();
|
||||
<span class="ident">jar</span>.<span class="ident">private_mut</span>(<span class="kw-2">&</span><span class="ident">Key::derive_from</span>(<span class="kw-2">&</span><span class="ident">COOKIE_KEY_MASTER</span>))
|
||||
.<span class="ident">add</span>(<span class="ident">Cookie::new</span>(<span class="ident">COOKIE_NAME</span>, <span class="ident">identity</span>));
|
||||
|
@ -148,7 +148,7 @@
|
||||
<span class="kw">impl</span> <span class="ident">Identity</span> {
|
||||
<span class="doccomment">/// Return the claimed identity of the user associated request or `None` if no identity can be</span>
|
||||
<span class="doccomment">/// found associated with the request.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">identity</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">identity</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
||||
<span class="ident">Identity::get_identity</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="number">0</span>.<span class="ident">extensions</span>())
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">get_identity</span>(<span class="ident">extensions</span>: <span class="kw-2">&</span><span class="ident">Extensions</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">get_identity</span>(<span class="ident">extensions</span>: <span class="kw-2">&</span><span class="ident">Extensions</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">id</span> <span class="op">=</span> <span class="ident">extensions</span>.<span class="ident">get</span>::<span class="op"><</span><span class="ident">IdentityItem</span><span class="op">></span>()<span class="question-mark">?</span>;
|
||||
<span class="ident">id</span>.<span class="ident">id</span>.<span class="ident">clone</span>()
|
||||
}
|
||||
@ -196,7 +196,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">Identity</span>, <span class="ident">Error</span><span class="op">></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="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</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="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="ident">ready</span>(<span class="prelude-val">Ok</span>(<span class="ident">Identity</span>(<span class="ident">req</span>.<span class="ident">clone</span>())))
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,7 @@
|
||||
<span class="kw">type</span> <span class="ident">ResponseFuture</span>: <span class="ident">Future</span><span class="op"><</span><span class="ident">Output</span> <span class="op">=</span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span><span class="op">></span>;
|
||||
|
||||
<span class="doccomment">/// Parse the session from request and load data from a service identity.</span>
|
||||
<span class="kw">fn</span> <span class="ident">from_request</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span>;
|
||||
<span class="kw">fn</span> <span class="ident">from_request</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceRequest</span>) -> <span class="ident"><span class="self">Self</span>::Future</span>;
|
||||
|
||||
<span class="doccomment">/// Write changes to response</span>
|
||||
<span class="kw">fn</span> <span class="ident">to_response</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>(
|
||||
@ -230,7 +230,7 @@
|
||||
<span class="ident">identity</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>,
|
||||
<span class="ident">changed</span>: <span class="ident">bool</span>,
|
||||
<span class="ident">response</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>,
|
||||
) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::ResponseFuture</span>;
|
||||
) -> <span class="ident"><span class="self">Self</span>::ResponseFuture</span>;
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Helper trait that allows to get Identity.</span>
|
||||
@ -238,14 +238,14 @@
|
||||
<span class="doccomment">/// It could be used in middleware but identity policy must be set before any other middleware that</span>
|
||||
<span class="doccomment">/// needs identity. RequestIdentity is implemented both for `ServiceRequest` and `HttpRequest`.</span>
|
||||
<span class="kw">pub</span> <span class="kw">trait</span> <span class="ident">RequestIdentity</span> {
|
||||
<span class="kw">fn</span> <span class="ident">get_identity</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>;
|
||||
<span class="kw">fn</span> <span class="ident">get_identity</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>;
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> <span class="ident">RequestIdentity</span> <span class="kw">for</span> <span class="ident">T</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">HttpMessage</span>,
|
||||
{
|
||||
<span class="kw">fn</span> <span class="ident">get_identity</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">get_identity</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
||||
<span class="ident">Identity::get_identity</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">extensions</span>())
|
||||
}
|
||||
}
|
||||
@ -276,10 +276,10 @@
|
||||
}
|
||||
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">async</span> <span class="kw">fn</span> <span class="ident">create_identity_server</span><span class="op"><</span>
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">CookieIdentityPolicy</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieIdentityPolicy</span> <span class="op">+</span> <span class="ident">Sync</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Clone</span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">CookieIdentityPolicy</span>) -> <span class="ident">CookieIdentityPolicy</span> <span class="op">+</span> <span class="ident">Sync</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Clone</span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="op">></span>(
|
||||
<span class="ident">f</span>: <span class="ident">F</span>,
|
||||
) <span class="op">-</span><span class="op">></span> <span class="kw">impl</span> <span class="ident">actix_service::Service</span><span class="op"><</span>
|
||||
) -> <span class="kw">impl</span> <span class="ident">actix_service::Service</span><span class="op"><</span>
|
||||
<span class="ident">actix_http::Request</span>,
|
||||
<span class="ident">Response</span> <span class="op">=</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">actix_web::body::Body</span><span class="op">></span>,
|
||||
<span class="ident">Error</span> <span class="op">=</span> <span class="ident">Error</span>,
|
||||
|
@ -202,7 +202,7 @@
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> <span class="ident">IdentityService</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="doccomment">/// Create new identity service with specified backend.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">backend</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">backend</span>: <span class="ident">T</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">IdentityService</span> {
|
||||
<span class="ident">backend</span>: <span class="ident">Rc::new</span>(<span class="ident">backend</span>),
|
||||
}
|
||||
@ -223,7 +223,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Transform</span> <span class="op">=</span> <span class="ident">IdentityServiceMiddleware</span><span class="op"><</span><span class="ident">S</span>, <span class="ident">T</span><span class="op">></span>;
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Transform</span>, <span class="ident"><span class="self">Self</span>::InitError</span><span class="op">></span><span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">new_transform</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">service</span>: <span class="ident">S</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">new_transform</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">service</span>: <span class="ident">S</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="ident">ready</span>(<span class="prelude-val">Ok</span>(<span class="ident">IdentityServiceMiddleware</span> {
|
||||
<span class="ident">backend</span>: <span class="self">self</span>.<span class="ident">backend</span>.<span class="ident">clone</span>(),
|
||||
<span class="ident">service</span>: <span class="ident">Rc::new</span>(<span class="ident">service</span>),
|
||||
@ -237,7 +237,7 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">S</span>, <span class="ident">T</span><span class="op">></span> <span class="ident">Clone</span> <span class="kw">for</span> <span class="ident">IdentityServiceMiddleware</span><span class="op"><</span><span class="ident">S</span>, <span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">clone</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">fn</span> <span class="ident">clone</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="self">Self</span> {
|
||||
<span class="self">Self</span> {
|
||||
<span class="ident">backend</span>: <span class="ident">Rc::clone</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">backend</span>),
|
||||
<span class="ident">service</span>: <span class="ident">Rc::clone</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">service</span>),
|
||||
@ -259,14 +259,14 @@
|
||||
|
||||
<span class="macro">actix_service::forward_ready!</span>(<span class="ident">service</span>);
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="kw-2">mut</span> <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="kw-2">mut</span> <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">let</span> <span class="ident">srv</span> <span class="op">=</span> <span class="ident">Rc::clone</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">service</span>);
|
||||
<span class="kw">let</span> <span class="ident">backend</span> <span class="op">=</span> <span class="ident">Rc::clone</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">backend</span>);
|
||||
<span class="kw">let</span> <span class="ident">fut</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">backend</span>.<span class="ident">from_request</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">req</span>);
|
||||
|
||||
<span class="kw">async</span> <span class="kw">move</span> {
|
||||
<span class="kw">match</span> <span class="ident">fut</span>.<span class="kw">await</span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">id</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">id</span>) => {
|
||||
<span class="ident">req</span>.<span class="ident">extensions_mut</span>()
|
||||
.<span class="ident">insert</span>(<span class="ident">IdentityItem</span> { <span class="ident">id</span>, <span class="ident">changed</span>: <span class="bool-val">false</span> });
|
||||
|
||||
@ -275,14 +275,14 @@
|
||||
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">id</span>) <span class="op">=</span> <span class="ident">id</span> {
|
||||
<span class="kw">match</span> <span class="ident">backend</span>.<span class="ident">to_response</span>(<span class="ident">id</span>.<span class="ident">id</span>, <span class="ident">id</span>.<span class="ident">changed</span>, <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">res</span>).<span class="kw">await</span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(<span class="ident">res</span>.<span class="ident">map_body</span>(<span class="op">|</span><span class="kw">_</span>, <span class="ident">body</span><span class="op">|</span> <span class="ident">AnyBody::from_message</span>(<span class="ident">body</span>))),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(<span class="ident">res</span>.<span class="ident">error_response</span>(<span class="ident">e</span>)),
|
||||
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) => <span class="prelude-val">Ok</span>(<span class="ident">res</span>.<span class="ident">map_body</span>(<span class="op">|</span><span class="kw">_</span>, <span class="ident">body</span><span class="op">|</span> <span class="ident">AnyBody::from_message</span>(<span class="ident">body</span>))),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">e</span>) => <span class="prelude-val">Ok</span>(<span class="ident">res</span>.<span class="ident">error_response</span>(<span class="ident">e</span>)),
|
||||
}
|
||||
} <span class="kw">else</span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">res</span>.<span class="ident">map_body</span>(<span class="op">|</span><span class="kw">_</span>, <span class="ident">body</span><span class="op">|</span> <span class="ident">AnyBody::from_message</span>(<span class="ident">body</span>)))
|
||||
}
|
||||
}
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(<span class="ident">req</span>.<span class="ident">error_response</span>(<span class="ident">err</span>)),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) => <span class="prelude-val">Ok</span>(<span class="ident">req</span>.<span class="ident">error_response</span>(<span class="ident">err</span>)),
|
||||
}
|
||||
}
|
||||
.<span class="ident">map_ok</span>(<span class="op">|</span><span class="ident">res</span><span class="op">|</span> <span class="ident">res</span>.<span class="ident">map_body</span>(<span class="op">|</span><span class="kw">_</span>, <span class="ident">body</span><span class="op">|</span> <span class="ident">AnyBody::from_message</span>(<span class="ident">body</span>)))
|
||||
@ -308,7 +308,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>, <span class="ident">Error</span><span class="op">></span><span class="op">></span>;
|
||||
<span class="kw">type</span> <span class="ident">ResponseFuture</span> <span class="op">=</span> <span class="ident">Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span><span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">from_request</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">dev::ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from_request</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">dev::ServiceRequest</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="ident">ok</span>(<span class="prelude-val">Some</span>(<span class="string">"test"</span>.<span class="ident">to_string</span>()))
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@
|
||||
<span class="kw">_</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>,
|
||||
<span class="kw">_</span>: <span class="ident">bool</span>,
|
||||
<span class="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">dev::ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>,
|
||||
) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::ResponseFuture</span> {
|
||||
) -> <span class="ident"><span class="self">Self</span>::ResponseFuture</span> {
|
||||
<span class="ident">ok</span>(())
|
||||
}
|
||||
}
|
||||
|
@ -375,22 +375,22 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">ResponseError</span> <span class="kw">for</span> <span class="ident">ProtoBufPayloadError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">error_response</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">HttpResponse</span> {
|
||||
<span class="kw">fn</span> <span class="ident">error_response</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">HttpResponse</span> {
|
||||
<span class="kw">match</span> <span class="kw-2">*</span><span class="self">self</span> {
|
||||
<span class="ident">ProtoBufPayloadError::Overflow</span> <span class="op">=</span><span class="op">></span> <span class="ident">HttpResponse::PayloadTooLarge</span>().<span class="ident">into</span>(),
|
||||
<span class="kw">_</span> <span class="op">=</span><span class="op">></span> <span class="ident">HttpResponse::BadRequest</span>().<span class="ident">into</span>(),
|
||||
<span class="ident">ProtoBufPayloadError::Overflow</span> => <span class="ident">HttpResponse::PayloadTooLarge</span>().<span class="ident">into</span>(),
|
||||
<span class="kw">_</span> => <span class="ident">HttpResponse::BadRequest</span>().<span class="ident">into</span>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">From</span><span class="op"><</span><span class="ident">PayloadError</span><span class="op">></span> <span class="kw">for</span> <span class="ident">ProtoBufPayloadError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">err</span>: <span class="ident">PayloadError</span>) <span class="op">-</span><span class="op">></span> <span class="ident">ProtoBufPayloadError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">err</span>: <span class="ident">PayloadError</span>) -> <span class="ident">ProtoBufPayloadError</span> {
|
||||
<span class="ident">ProtoBufPayloadError::Payload</span>(<span class="ident">err</span>)
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">From</span><span class="op"><</span><span class="ident">ProtoBufDecodeError</span><span class="op">></span> <span class="kw">for</span> <span class="ident">ProtoBufPayloadError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">err</span>: <span class="ident">ProtoBufDecodeError</span>) <span class="op">-</span><span class="op">></span> <span class="ident">ProtoBufPayloadError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">err</span>: <span class="ident">ProtoBufDecodeError</span>) -> <span class="ident">ProtoBufPayloadError</span> {
|
||||
<span class="ident">ProtoBufPayloadError::Deserialize</span>(<span class="ident">err</span>)
|
||||
}
|
||||
}
|
||||
@ -400,13 +400,13 @@
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Message</span><span class="op">></span> <span class="ident">Deref</span> <span class="kw">for</span> <span class="ident">ProtoBuf</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">type</span> <span class="ident">Target</span> <span class="op">=</span> <span class="ident">T</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">deref</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="ident">T</span> {
|
||||
<span class="kw">fn</span> <span class="ident">deref</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw-2">&</span><span class="ident">T</span> {
|
||||
<span class="kw-2">&</span><span class="self">self</span>.<span class="number">0</span>
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Message</span><span class="op">></span> <span class="ident">DerefMut</span> <span class="kw">for</span> <span class="ident">ProtoBuf</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">deref_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">T</span> {
|
||||
<span class="kw">fn</span> <span class="ident">deref_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">T</span> {
|
||||
<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>
|
||||
}
|
||||
}
|
||||
@ -415,7 +415,7 @@
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">fmt::Debug</span>,
|
||||
{
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="macro">write!</span>(<span class="ident">f</span>, <span class="string">"ProtoBuf: {:?}"</span>, <span class="self">self</span>.<span class="number">0</span>)
|
||||
}
|
||||
}
|
||||
@ -424,7 +424,7 @@
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">fmt::Display</span>,
|
||||
{
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="ident">fmt::Display::fmt</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="number">0</span>, <span class="ident">f</span>)
|
||||
}
|
||||
}
|
||||
@ -435,14 +435,14 @@
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">ProtoBufConfig</span> {
|
||||
<span class="doccomment">/// Change max size of payload. By default max size is 256Kb</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">limit</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">limit</span>: <span class="ident">usize</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">limit</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">limit</span>: <span class="ident">usize</span>) -> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">Self</span> {
|
||||
<span class="self">self</span>.<span class="ident">limit</span> <span class="op">=</span> <span class="ident">limit</span>;
|
||||
<span class="self">self</span>
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Default</span> <span class="kw">for</span> <span class="ident">ProtoBufConfig</span> {
|
||||
<span class="kw">fn</span> <span class="ident">default</span>() <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">fn</span> <span class="ident">default</span>() -> <span class="self">Self</span> {
|
||||
<span class="ident">ProtoBufConfig</span> { <span class="ident">limit</span>: <span class="number">262_144</span> }
|
||||
}
|
||||
}
|
||||
@ -456,7 +456,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">LocalBoxFuture</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">Error</span><span class="op">></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="ident">payload</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</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="ident">payload</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">let</span> <span class="ident">limit</span> <span class="op">=</span> <span class="ident">req</span>
|
||||
.<span class="ident">app_data</span>::<span class="op"><</span><span class="ident">ProtoBufConfig</span><span class="op">></span>()
|
||||
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">limit</span>)
|
||||
@ -464,21 +464,21 @@
|
||||
<span class="ident">ProtoBufMessage::new</span>(<span class="ident">req</span>, <span class="ident">payload</span>)
|
||||
.<span class="ident">limit</span>(<span class="ident">limit</span>)
|
||||
.<span class="ident">map</span>(<span class="kw">move</span> <span class="op">|</span><span class="ident">res</span><span class="op">|</span> <span class="kw">match</span> <span class="ident">res</span> {
|
||||
<span class="prelude-val">Err</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Err</span>(<span class="ident">e</span>.<span class="ident">into</span>()),
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">item</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(<span class="ident">ProtoBuf</span>(<span class="ident">item</span>)),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">e</span>) => <span class="prelude-val">Err</span>(<span class="ident">e</span>.<span class="ident">into</span>()),
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">item</span>) => <span class="prelude-val">Ok</span>(<span class="ident">ProtoBuf</span>(<span class="ident">item</span>)),
|
||||
})
|
||||
.<span class="ident">boxed_local</span>()
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Message</span> <span class="op">+</span> <span class="ident">Default</span><span class="op">></span> <span class="ident">Responder</span> <span class="kw">for</span> <span class="ident">ProtoBuf</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">respond_to</span>(<span class="self">self</span>, <span class="kw">_</span>: <span class="kw-2">&</span><span class="ident">HttpRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident">HttpResponse</span> {
|
||||
<span class="kw">fn</span> <span class="ident">respond_to</span>(<span class="self">self</span>, <span class="kw">_</span>: <span class="kw-2">&</span><span class="ident">HttpRequest</span>) -> <span class="ident">HttpResponse</span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buf</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
|
||||
<span class="kw">match</span> <span class="self">self</span>.<span class="number">0</span>.<span class="ident">encode</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">buf</span>) {
|
||||
<span class="prelude-val">Ok</span>(()) <span class="op">=</span><span class="op">></span> <span class="ident">HttpResponse::Ok</span>()
|
||||
<span class="prelude-val">Ok</span>(()) => <span class="ident">HttpResponse::Ok</span>()
|
||||
.<span class="ident">content_type</span>(<span class="string">"application/protobuf"</span>)
|
||||
.<span class="ident">body</span>(<span class="ident">buf</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> <span class="ident">HttpResponse::from_error</span>(<span class="ident">Error::from</span>(<span class="ident">ProtoBufPayloadError::Serialize</span>(<span class="ident">err</span>))),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) => <span class="ident">HttpResponse::from_error</span>(<span class="ident">Error::from</span>(<span class="ident">ProtoBufPayloadError::Serialize</span>(<span class="ident">err</span>))),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -493,7 +493,7 @@
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Message</span> <span class="op">+</span> <span class="ident">Default</span><span class="op">></span> <span class="ident">ProtoBufMessage</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="doccomment">/// Create `ProtoBufMessage` for request.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">HttpRequest</span>, <span class="ident">payload</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">HttpRequest</span>, <span class="ident">payload</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) -> <span class="self">Self</span> {
|
||||
<span class="kw">if</span> <span class="ident">req</span>.<span class="ident">content_type</span>() <span class="op">!</span><span class="op">=</span> <span class="string">"application/protobuf"</span> {
|
||||
<span class="kw">return</span> <span class="ident">ProtoBufMessage</span> {
|
||||
<span class="ident">limit</span>: <span class="number">262_144</span>,
|
||||
@ -523,7 +523,7 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Change max size of payload. By default max size is 256Kb</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">limit</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">limit</span>: <span class="ident">usize</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">limit</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">limit</span>: <span class="ident">usize</span>) -> <span class="self">Self</span> {
|
||||
<span class="self">self</span>.<span class="ident">limit</span> <span class="op">=</span> <span class="ident">limit</span>;
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -532,7 +532,7 @@
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Message</span> <span class="op">+</span> <span class="ident">Default</span> <span class="op">+</span> <span class="lifetime">'static</span><span class="op">></span> <span class="ident">Future</span> <span class="kw">for</span> <span class="ident">ProtoBufMessage</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">type</span> <span class="ident">Output</span> <span class="op">=</span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">T</span>, <span class="ident">ProtoBufPayloadError</span><span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">poll</span>(<span class="kw-2">mut</span> <span class="self">self</span>: <span class="ident">Pin</span><span class="op"><</span><span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">Self</span><span class="op">></span>, <span class="ident">task</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">task::Context</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">Poll</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Output</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">poll</span>(<span class="kw-2">mut</span> <span class="self">self</span>: <span class="ident">Pin</span><span class="op"><</span><span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">Self</span><span class="op">></span>, <span class="ident">task</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">task::Context</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">Poll</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Output</span><span class="op">></span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="kw-2">ref</span> <span class="kw-2">mut</span> <span class="ident">fut</span>) <span class="op">=</span> <span class="self">self</span>.<span class="ident">fut</span> {
|
||||
<span class="kw">return</span> <span class="ident">Pin::new</span>(<span class="ident">fut</span>).<span class="ident">poll</span>(<span class="ident">task</span>);
|
||||
}
|
||||
@ -575,11 +575,11 @@
|
||||
}
|
||||
|
||||
<span class="kw">pub</span> <span class="kw">trait</span> <span class="ident">ProtoBufResponseBuilder</span> {
|
||||
<span class="kw">fn</span> <span class="ident">protobuf</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Message</span><span class="op">></span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span>, <span class="ident">Error</span><span class="op">></span>;
|
||||
<span class="kw">fn</span> <span class="ident">protobuf</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Message</span><span class="op">></span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span>, <span class="ident">Error</span><span class="op">></span>;
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">ProtoBufResponseBuilder</span> <span class="kw">for</span> <span class="ident">HttpResponseBuilder</span> {
|
||||
<span class="kw">fn</span> <span class="ident">protobuf</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Message</span><span class="op">></span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span>, <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">protobuf</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Message</span><span class="op">></span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span>, <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="self">self</span>.<span class="ident">insert_header</span>((<span class="ident">CONTENT_TYPE</span>, <span class="string">"application/protobuf"</span>));
|
||||
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">body</span> <span class="op">=</span> <span class="ident">Vec::new</span>();
|
||||
@ -597,15 +597,15 @@
|
||||
<span class="kw">use</span> <span class="ident">actix_web::test::TestRequest</span>;
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">PartialEq</span> <span class="kw">for</span> <span class="ident">ProtoBufPayloadError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">eq</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">other</span>: <span class="kw-2">&</span><span class="ident">ProtoBufPayloadError</span>) <span class="op">-</span><span class="op">></span> <span class="ident">bool</span> {
|
||||
<span class="kw">fn</span> <span class="ident">eq</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">other</span>: <span class="kw-2">&</span><span class="ident">ProtoBufPayloadError</span>) -> <span class="ident">bool</span> {
|
||||
<span class="kw">match</span> <span class="kw-2">*</span><span class="self">self</span> {
|
||||
<span class="ident">ProtoBufPayloadError::Overflow</span> <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">ProtoBufPayloadError::Overflow</span> => {
|
||||
<span class="macro">matches!</span>(<span class="kw-2">*</span><span class="ident">other</span>, <span class="ident">ProtoBufPayloadError::Overflow</span>)
|
||||
}
|
||||
<span class="ident">ProtoBufPayloadError::ContentType</span> <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">ProtoBufPayloadError::ContentType</span> => {
|
||||
<span class="macro">matches!</span>(<span class="kw-2">*</span><span class="ident">other</span>, <span class="ident">ProtoBufPayloadError::ContentType</span>)
|
||||
}
|
||||
<span class="kw">_</span> <span class="op">=</span><span class="op">></span> <span class="bool-val">false</span>,
|
||||
<span class="kw">_</span> => <span class="bool-val">false</span>,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">RedisActor</span> {
|
||||
<span class="doccomment">/// Start new `Supervisor` with `RedisActor`.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">start</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span><span class="op">></span>(<span class="ident">addr</span>: <span class="ident">S</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Addr</span><span class="op"><</span><span class="ident">RedisActor</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">start</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span><span class="op">></span>(<span class="ident">addr</span>: <span class="ident">S</span>) -> <span class="ident">Addr</span><span class="op"><</span><span class="ident">RedisActor</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">addr</span> <span class="op">=</span> <span class="ident">addr</span>.<span class="ident">into</span>();
|
||||
|
||||
<span class="kw">let</span> <span class="ident">backoff</span> <span class="op">=</span> <span class="ident">ExponentialBackoff</span> {
|
||||
@ -203,7 +203,7 @@
|
||||
.<span class="ident">call</span>(<span class="ident">req</span>)
|
||||
.<span class="ident">into_actor</span>(<span class="self">self</span>)
|
||||
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">res</span>, <span class="ident">act</span>, <span class="ident">ctx</span><span class="op">|</span> <span class="kw">match</span> <span class="ident">res</span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">conn</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">conn</span>) => {
|
||||
<span class="kw">let</span> <span class="ident">stream</span> <span class="op">=</span> <span class="ident">conn</span>.<span class="ident">into_parts</span>().<span class="number">0</span>;
|
||||
<span class="macro">info!</span>(<span class="string">"Connected to redis server: {}"</span>, <span class="ident">act</span>.<span class="ident">addr</span>);
|
||||
|
||||
@ -218,7 +218,7 @@
|
||||
|
||||
<span class="ident">act</span>.<span class="ident">backoff</span>.<span class="ident">reset</span>();
|
||||
}
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) => {
|
||||
<span class="macro">error!</span>(<span class="string">"Can not connect to redis server: {}"</span>, <span class="ident">err</span>);
|
||||
<span class="comment">// re-connect with backoff time.</span>
|
||||
<span class="comment">// we stop current context, supervisor will restart it.</span>
|
||||
@ -241,7 +241,7 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">actix::io::WriteHandler</span><span class="op"><</span><span class="ident">io::Error</span><span class="op">></span> <span class="kw">for</span> <span class="ident">RedisActor</span> {
|
||||
<span class="kw">fn</span> <span class="ident">error</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">err</span>: <span class="ident">io::Error</span>, <span class="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident"><span class="self">Self</span>::Context</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Running</span> {
|
||||
<span class="kw">fn</span> <span class="ident">error</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">err</span>: <span class="ident">io::Error</span>, <span class="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident"><span class="self">Self</span>::Context</span>) -> <span class="ident">Running</span> {
|
||||
<span class="macro">warn!</span>(<span class="string">"Redis connection dropped: {} error: {}"</span>, <span class="self">self</span>.<span class="ident">addr</span>, <span class="ident">err</span>);
|
||||
<span class="ident">Running::Stop</span>
|
||||
}
|
||||
@ -250,13 +250,13 @@
|
||||
<span class="kw">impl</span> <span class="ident">StreamHandler</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">RespValue</span>, <span class="ident">RespError</span><span class="op">></span><span class="op">></span> <span class="kw">for</span> <span class="ident">RedisActor</span> {
|
||||
<span class="kw">fn</span> <span class="ident">handle</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">msg</span>: <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">RespValue</span>, <span class="ident">RespError</span><span class="op">></span>, <span class="ident">ctx</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident"><span class="self">Self</span>::Context</span>) {
|
||||
<span class="kw">match</span> <span class="ident">msg</span> {
|
||||
<span class="prelude-val">Err</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Err</span>(<span class="ident">e</span>) => {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">tx</span>) <span class="op">=</span> <span class="self">self</span>.<span class="ident">queue</span>.<span class="ident">pop_front</span>() {
|
||||
<span class="kw">let</span> <span class="kw">_</span> <span class="op">=</span> <span class="ident">tx</span>.<span class="ident">send</span>(<span class="prelude-val">Err</span>(<span class="ident">e</span>.<span class="ident">into</span>()));
|
||||
}
|
||||
<span class="ident">ctx</span>.<span class="ident">stop</span>();
|
||||
}
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">val</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">val</span>) => {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">tx</span>) <span class="op">=</span> <span class="self">self</span>.<span class="ident">queue</span>.<span class="ident">pop_front</span>() {
|
||||
<span class="kw">let</span> <span class="kw">_</span> <span class="op">=</span> <span class="ident">tx</span>.<span class="ident">send</span>(<span class="prelude-val">Ok</span>(<span class="ident">val</span>));
|
||||
}
|
||||
@ -268,7 +268,7 @@
|
||||
<span class="kw">impl</span> <span class="ident">Handler</span><span class="op"><</span><span class="ident">Command</span><span class="op">></span> <span class="kw">for</span> <span class="ident">RedisActor</span> {
|
||||
<span class="kw">type</span> <span class="prelude-ty">Result</span> <span class="op">=</span> <span class="ident">ResponseFuture</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">RespValue</span>, <span class="ident">Error</span><span class="op">></span><span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">handle</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">msg</span>: <span class="ident">Command</span>, <span class="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident"><span class="self">Self</span>::Context</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">handle</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">msg</span>: <span class="ident">Command</span>, <span class="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident"><span class="self">Self</span>::Context</span>) -> <span class="ident"><span class="self">Self</span>::Result</span> {
|
||||
<span class="kw">let</span> (<span class="ident">tx</span>, <span class="ident">rx</span>) <span class="op">=</span> <span class="ident">oneshot::channel</span>();
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="kw-2">ref</span> <span class="kw-2">mut</span> <span class="ident">cell</span>) <span class="op">=</span> <span class="self">self</span>.<span class="ident">cell</span> {
|
||||
<span class="self">self</span>.<span class="ident">queue</span>.<span class="ident">push_back</span>(<span class="ident">tx</span>);
|
||||
|
@ -736,7 +736,7 @@
|
||||
<span class="doccomment">/// Create new redis session backend</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// * `addr` - address of the redis server</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span><span class="op">></span>(<span class="ident">addr</span>: <span class="ident">S</span>, <span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>]) <span class="op">-</span><span class="op">></span> <span class="ident">RedisSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span><span class="op">></span>(<span class="ident">addr</span>: <span class="ident">S</span>, <span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>]) -> <span class="ident">RedisSession</span> {
|
||||
<span class="ident">RedisSession</span>(<span class="ident">Rc::new</span>(<span class="ident">Inner</span> {
|
||||
<span class="ident">key</span>: <span class="ident">Key::derive_from</span>(<span class="ident">key</span>),
|
||||
<span class="ident">cache_keygen</span>: <span class="ident">Box::new</span>(<span class="op">|</span><span class="ident">key</span>: <span class="kw-2">&</span><span class="ident">str</span><span class="op">|</span> <span class="macro">format!</span>(<span class="string">"session:{}"</span>, <span class="kw-2">&</span><span class="ident">key</span>)),
|
||||
@ -753,25 +753,25 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Set time to live in seconds for session value.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">ttl</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">ttl</span>: <span class="ident">u32</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">ttl</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">ttl</span>: <span class="ident">u32</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">ttl</span> <span class="op">=</span> <span class="macro">format!</span>(<span class="string">"{}"</span>, <span class="ident">ttl</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Set custom cookie name for session ID.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_name</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">name</span>: <span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_name</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">name</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">name</span> <span class="op">=</span> <span class="ident">name</span>.<span class="ident">to_owned</span>();
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Set custom cookie path.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_path</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">path</span>: <span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_path</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">path</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">path</span> <span class="op">=</span> <span class="ident">path</span>.<span class="ident">to_owned</span>();
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Set custom cookie domain.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_domain</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">domain</span>: <span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_domain</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">domain</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">domain</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">domain</span>.<span class="ident">to_owned</span>());
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -782,7 +782,7 @@
|
||||
<span class="doccomment">/// connection is secure - i.e. `https`.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Default is false.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_secure</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">secure</span>: <span class="ident">bool</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_secure</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">secure</span>: <span class="ident">bool</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">secure</span> <span class="op">=</span> <span class="ident">secure</span>;
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -790,7 +790,7 @@
|
||||
<span class="doccomment">/// Set custom cookie max-age.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Use `None` for session-only cookies.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_max_age</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">max_age</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Duration</span><span class="op">></span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_max_age</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">max_age</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Duration</span><span class="op">></span><span class="op">></span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">max_age</span> <span class="op">=</span> <span class="ident">max_age</span>.<span class="ident">into</span>();
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -798,7 +798,7 @@
|
||||
<span class="doccomment">/// Set custom cookie `SameSite` attribute.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// By default, the attribute is omitted.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_same_site</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">same_site</span>: <span class="ident">SameSite</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_same_site</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">same_site</span>: <span class="ident">SameSite</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">same_site</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">same_site</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -806,13 +806,13 @@
|
||||
<span class="doccomment">/// Set custom cookie `HttpOnly` policy.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Default is true.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_http_only</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">http_only</span>: <span class="ident">bool</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cookie_http_only</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">http_only</span>: <span class="ident">bool</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">http_only</span> <span class="op">=</span> <span class="ident">http_only</span>;
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Set a custom cache key generation strategy, expecting session key as input.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cache_keygen</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">keygen</span>: <span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">Fn</span>(<span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="ident">String</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">cache_keygen</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">keygen</span>: <span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">Fn</span>(<span class="kw-2">&</span><span class="ident">str</span>) -> <span class="ident">String</span><span class="op">></span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">cache_keygen</span> <span class="op">=</span> <span class="ident">keygen</span>;
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -830,7 +830,7 @@
|
||||
<span class="kw">type</span> <span class="ident">InitError</span> <span class="op">=</span> ();
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">LocalBoxFuture</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Transform</span>, <span class="ident"><span class="self">Self</span>::InitError</span><span class="op">></span><span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">new_transform</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">service</span>: <span class="ident">S</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">new_transform</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">service</span>: <span class="ident">S</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">let</span> <span class="ident">inner</span> <span class="op">=</span> <span class="self">self</span>.<span class="number">0</span>.<span class="ident">clone</span>();
|
||||
<span class="ident">Box::pin</span>(<span class="kw">async</span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">RedisSessionMiddleware</span> {
|
||||
@ -859,7 +859,7 @@
|
||||
|
||||
<span class="macro">actix_service::forward_ready!</span>(<span class="ident">service</span>);
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="kw-2">mut</span> <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="kw-2">mut</span> <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">let</span> <span class="ident">srv</span> <span class="op">=</span> <span class="ident">Rc::clone</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">service</span>);
|
||||
<span class="kw">let</span> <span class="ident">inner</span> <span class="op">=</span> <span class="ident">Rc::clone</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">inner</span>);
|
||||
|
||||
@ -876,7 +876,7 @@
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">srv</span>.<span class="ident">call</span>(<span class="ident">req</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
|
||||
<span class="kw">match</span> <span class="ident">Session::get_changes</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">res</span>) {
|
||||
(<span class="ident">SessionStatus::Unchanged</span>, <span class="ident">state</span>) <span class="op">=</span><span class="op">></span> {
|
||||
(<span class="ident">SessionStatus::Unchanged</span>, <span class="ident">state</span>) => {
|
||||
<span class="kw">if</span> <span class="ident">value</span>.<span class="ident">is_none</span>() {
|
||||
<span class="comment">// implies the session is new</span>
|
||||
<span class="ident">inner</span>.<span class="ident">update</span>(<span class="ident">res</span>, <span class="ident">state</span>, <span class="ident">value</span>).<span class="kw">await</span>
|
||||
@ -885,21 +885,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
(<span class="ident">SessionStatus::Changed</span>, <span class="ident">state</span>) <span class="op">=</span><span class="op">></span> <span class="ident">inner</span>.<span class="ident">update</span>(<span class="ident">res</span>, <span class="ident">state</span>, <span class="ident">value</span>).<span class="kw">await</span>,
|
||||
(<span class="ident">SessionStatus::Changed</span>, <span class="ident">state</span>) => <span class="ident">inner</span>.<span class="ident">update</span>(<span class="ident">res</span>, <span class="ident">state</span>, <span class="ident">value</span>).<span class="kw">await</span>,
|
||||
|
||||
(<span class="ident">SessionStatus::Purged</span>, <span class="kw">_</span>) <span class="op">=</span><span class="op">></span> {
|
||||
(<span class="ident">SessionStatus::Purged</span>, <span class="kw">_</span>) => {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">val</span>) <span class="op">=</span> <span class="ident">value</span> {
|
||||
<span class="ident">inner</span>.<span class="ident">clear_cache</span>(<span class="ident">val</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<span class="kw">match</span> <span class="ident">inner</span>.<span class="ident">remove_cookie</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">res</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(<span class="ident">res</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">_err</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Err</span>(<span class="ident">error::ErrorInternalServerError</span>(<span class="ident">_err</span>)),
|
||||
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) => <span class="prelude-val">Ok</span>(<span class="ident">res</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">_err</span>) => <span class="prelude-val">Err</span>(<span class="ident">error::ErrorInternalServerError</span>(<span class="ident">_err</span>)),
|
||||
}
|
||||
} <span class="kw">else</span> {
|
||||
<span class="prelude-val">Err</span>(<span class="ident">error::ErrorInternalServerError</span>(<span class="string">"unexpected"</span>))
|
||||
}
|
||||
}
|
||||
|
||||
(<span class="ident">SessionStatus::Renewed</span>, <span class="ident">state</span>) <span class="op">=</span><span class="op">></span> {
|
||||
(<span class="ident">SessionStatus::Renewed</span>, <span class="ident">state</span>) => {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">val</span>) <span class="op">=</span> <span class="ident">value</span> {
|
||||
<span class="ident">inner</span>.<span class="ident">clear_cache</span>(<span class="ident">val</span>).<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
<span class="ident">inner</span>.<span class="ident">update</span>(<span class="ident">res</span>, <span class="ident">state</span>, <span class="prelude-val">None</span>).<span class="kw">await</span>
|
||||
@ -914,7 +914,7 @@
|
||||
|
||||
<span class="kw">struct</span> <span class="ident">Inner</span> {
|
||||
<span class="ident">key</span>: <span class="ident">Key</span>,
|
||||
<span class="ident">cache_keygen</span>: <span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">Fn</span>(<span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="ident">String</span><span class="op">></span>,
|
||||
<span class="ident">cache_keygen</span>: <span class="ident">Box</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">Fn</span>(<span class="kw-2">&</span><span class="ident">str</span>) -> <span class="ident">String</span><span class="op">></span>,
|
||||
<span class="ident">ttl</span>: <span class="ident">String</span>,
|
||||
<span class="ident">addr</span>: <span class="ident">Addr</span><span class="op"><</span><span class="ident">RedisActor</span><span class="op">></span>,
|
||||
<span class="ident">name</span>: <span class="ident">String</span>,
|
||||
@ -930,7 +930,7 @@
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">load</span>(
|
||||
<span class="kw-2">&</span><span class="self">self</span>,
|
||||
<span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">ServiceRequest</span>,
|
||||
) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span>(<span class="ident">HashMap</span><span class="op"><</span><span class="ident">String</span>, <span class="ident">String</span><span class="op">></span>, <span class="ident">String</span>)<span class="op">></span>, <span class="ident">Error</span><span class="op">></span> {
|
||||
) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span>(<span class="ident">HashMap</span><span class="op"><</span><span class="ident">String</span>, <span class="ident">String</span><span class="op">></span>, <span class="ident">String</span>)<span class="op">></span>, <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="comment">// wrapped in block to avoid holding `Ref` (from `req.cookies`) across await point</span>
|
||||
<span class="kw">let</span> (<span class="ident">value</span>, <span class="ident">cache_key</span>) <span class="op">=</span> {
|
||||
<span class="kw">let</span> <span class="ident">cookies</span> <span class="op">=</span> <span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Ok</span>(<span class="ident">cookies</span>) <span class="op">=</span> <span class="ident">req</span>.<span class="ident">cookies</span>() {
|
||||
@ -939,7 +939,7 @@
|
||||
<span class="kw">return</span> <span class="prelude-val">Ok</span>(<span class="prelude-val">None</span>);
|
||||
};
|
||||
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cookie</span>) <span class="op">=</span> <span class="ident">cookies</span>.<span class="ident">iter</span>().<span class="ident">find</span>(<span class="op">|</span><span class="kw-2">&</span><span class="ident">cookie</span><span class="op">|</span> <span class="ident">cookie</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="self">self</span>.<span class="ident">name</span>) {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cookie</span>) <span class="op">=</span> <span class="ident">cookies</span>.<span class="ident">iter</span>().<span class="ident">find</span>(<span class="op">|</span><span class="kw-2">&</span><span class="ident">cookie</span><span class="op">|</span> <span class="ident">cookie</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="self">self</span>.<span class="ident">name</span>) {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">jar</span> <span class="op">=</span> <span class="ident">CookieJar::new</span>();
|
||||
<span class="ident">jar</span>.<span class="ident">add_original</span>(<span class="ident">cookie</span>.<span class="ident">clone</span>());
|
||||
|
||||
@ -963,20 +963,20 @@
|
||||
.<span class="ident">map_err</span>(<span class="ident">error::ErrorInternalServerError</span>)<span class="question-mark">?</span>;
|
||||
|
||||
<span class="kw">match</span> <span class="ident">val</span> {
|
||||
<span class="ident">RespValue::Error</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">RespValue::Error</span>(<span class="ident">err</span>) => {
|
||||
<span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">error::ErrorInternalServerError</span>(<span class="ident">err</span>));
|
||||
}
|
||||
<span class="ident">RespValue::SimpleString</span>(<span class="ident">s</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">RespValue::SimpleString</span>(<span class="ident">s</span>) => {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Ok</span>(<span class="ident">val</span>) <span class="op">=</span> <span class="ident">serde_json::from_str</span>(<span class="kw-2">&</span><span class="ident">s</span>) {
|
||||
<span class="kw">return</span> <span class="prelude-val">Ok</span>(<span class="prelude-val">Some</span>((<span class="ident">val</span>, <span class="ident">value</span>)));
|
||||
}
|
||||
}
|
||||
<span class="ident">RespValue::BulkString</span>(<span class="ident">s</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">RespValue::BulkString</span>(<span class="ident">s</span>) => {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Ok</span>(<span class="ident">val</span>) <span class="op">=</span> <span class="ident">serde_json::from_slice</span>(<span class="kw-2">&</span><span class="ident">s</span>) {
|
||||
<span class="kw">return</span> <span class="prelude-val">Ok</span>(<span class="prelude-val">Some</span>((<span class="ident">val</span>, <span class="ident">value</span>)));
|
||||
}
|
||||
}
|
||||
<span class="kw">_</span> <span class="op">=</span><span class="op">></span> {}
|
||||
<span class="kw">_</span> => {}
|
||||
}
|
||||
|
||||
<span class="prelude-val">Ok</span>(<span class="prelude-val">None</span>)
|
||||
@ -987,7 +987,7 @@
|
||||
<span class="kw-2">mut</span> <span class="ident">res</span>: <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>,
|
||||
<span class="ident">state</span>: <span class="kw">impl</span> <span class="ident">Iterator</span><span class="op"><</span><span class="ident">Item</span> <span class="op">=</span> (<span class="ident">String</span>, <span class="ident">String</span>)<span class="op">></span>,
|
||||
<span class="ident">value</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>,
|
||||
) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>, <span class="ident">Error</span><span class="op">></span> {
|
||||
) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>, <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">let</span> (<span class="ident">value</span>, <span class="ident">jar</span>) <span class="op">=</span> <span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">value</span>) <span class="op">=</span> <span class="ident">value</span> {
|
||||
(<span class="ident">value</span>, <span class="prelude-val">None</span>)
|
||||
} <span class="kw">else</span> {
|
||||
@ -1027,8 +1027,8 @@
|
||||
<span class="kw">let</span> <span class="ident">state</span>: <span class="ident">HashMap</span><span class="op"><</span><span class="kw">_</span>, <span class="kw">_</span><span class="op">></span> <span class="op">=</span> <span class="ident">state</span>.<span class="ident">collect</span>();
|
||||
|
||||
<span class="kw">let</span> <span class="ident">body</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">serde_json::to_string</span>(<span class="kw-2">&</span><span class="ident">state</span>) {
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) <span class="op">=</span><span class="op">></span> <span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">err</span>.<span class="ident">into</span>()),
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">body</span>) <span class="op">=</span><span class="op">></span> <span class="ident">body</span>,
|
||||
<span class="prelude-val">Err</span>(<span class="ident">err</span>) => <span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">err</span>.<span class="ident">into</span>()),
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">body</span>) => <span class="ident">body</span>,
|
||||
};
|
||||
|
||||
<span class="kw">let</span> <span class="ident">cmd</span> <span class="op">=</span> <span class="ident">Command</span>(<span class="macro">resp_array!</span>[<span class="string">"SET"</span>, <span class="ident">cache_key</span>, <span class="ident">body</span>, <span class="string">"EX"</span>, <span class="kw-2">&</span><span class="self">self</span>.<span class="ident">ttl</span>]);
|
||||
@ -1050,7 +1050,7 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Removes cache entry.</span>
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">clear_cache</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">key</span>: <span class="ident">String</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">clear_cache</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">key</span>: <span class="ident">String</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">cache_key</span> <span class="op">=</span> (<span class="self">self</span>.<span class="ident">cache_keygen</span>)(<span class="kw-2">&</span><span class="ident">key</span>);
|
||||
|
||||
<span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="self">self</span>
|
||||
@ -1061,15 +1061,15 @@
|
||||
|
||||
<span class="kw">match</span> <span class="ident">res</span> {
|
||||
<span class="comment">// redis responds with number of deleted records</span>
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">RespValue::Integer</span>(<span class="ident">x</span>)) <span class="kw">if</span> <span class="ident">x</span> <span class="op">></span> <span class="number">0</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(()),
|
||||
<span class="kw">_</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">Err</span>(<span class="ident">error::ErrorInternalServerError</span>(
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">RespValue::Integer</span>(<span class="ident">x</span>)) <span class="kw">if</span> <span class="ident">x</span> <span class="op">></span> <span class="number">0</span> => <span class="prelude-val">Ok</span>(()),
|
||||
<span class="kw">_</span> => <span class="prelude-val">Err</span>(<span class="ident">error::ErrorInternalServerError</span>(
|
||||
<span class="string">"failed to remove session from cache"</span>,
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Invalidates session cookie.</span>
|
||||
<span class="kw">fn</span> <span class="ident">remove_cookie</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">res</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">remove_cookie</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">res</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>) -> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cookie</span> <span class="op">=</span> <span class="ident">Cookie::named</span>(<span class="self">self</span>.<span class="ident">name</span>.<span class="ident">clone</span>());
|
||||
<span class="ident">cookie</span>.<span class="ident">set_value</span>(<span class="string">""</span>);
|
||||
<span class="ident">cookie</span>.<span class="ident">set_max_age</span>(<span class="ident">Duration::zero</span>());
|
||||
@ -1101,7 +1101,7 @@
|
||||
<span class="ident">counter</span>: <span class="ident">i32</span>,
|
||||
}
|
||||
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">session</span>: <span class="ident">Session</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span><span class="op">></span> {
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">index</span>(<span class="ident">session</span>: <span class="ident">Session</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">user_id</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> <span class="op">=</span> <span class="ident">session</span>.<span class="ident">get</span>::<span class="op"><</span><span class="ident">String</span><span class="op">></span>(<span class="string">"user_id"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="kw">let</span> <span class="ident">counter</span>: <span class="ident">i32</span> <span class="op">=</span> <span class="ident">session</span>
|
||||
.<span class="ident">get</span>::<span class="op"><</span><span class="ident">i32</span><span class="op">></span>(<span class="string">"counter"</span>)
|
||||
@ -1111,7 +1111,7 @@
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">HttpResponse::Ok</span>().<span class="ident">json</span>(<span class="kw-2">&</span><span class="ident">IndexResponse</span> { <span class="ident">user_id</span>, <span class="ident">counter</span> }))
|
||||
}
|
||||
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">do_something</span>(<span class="ident">session</span>: <span class="ident">Session</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span><span class="op">></span> {
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">do_something</span>(<span class="ident">session</span>: <span class="ident">Session</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">user_id</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> <span class="op">=</span> <span class="ident">session</span>.<span class="ident">get</span>::<span class="op"><</span><span class="ident">String</span><span class="op">></span>(<span class="string">"user_id"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="kw">let</span> <span class="ident">counter</span>: <span class="ident">i32</span> <span class="op">=</span> <span class="ident">session</span>
|
||||
.<span class="ident">get</span>::<span class="op"><</span><span class="ident">i32</span><span class="op">></span>(<span class="string">"counter"</span>)
|
||||
@ -1127,7 +1127,7 @@
|
||||
<span class="ident">user_id</span>: <span class="ident">String</span>,
|
||||
}
|
||||
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">login</span>(<span class="ident">user_id</span>: <span class="ident">web::Json</span><span class="op"><</span><span class="ident">Identity</span><span class="op">></span>, <span class="ident">session</span>: <span class="ident">Session</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span><span class="op">></span> {
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">login</span>(<span class="ident">user_id</span>: <span class="ident">web::Json</span><span class="op"><</span><span class="ident">Identity</span><span class="op">></span>, <span class="ident">session</span>: <span class="ident">Session</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">id</span> <span class="op">=</span> <span class="ident">user_id</span>.<span class="ident">into_inner</span>().<span class="ident">user_id</span>;
|
||||
<span class="ident">session</span>.<span class="ident">insert</span>(<span class="string">"user_id"</span>, <span class="kw-2">&</span><span class="ident">id</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">session</span>.<span class="ident">renew</span>();
|
||||
@ -1143,7 +1143,7 @@
|
||||
}))
|
||||
}
|
||||
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">logout</span>(<span class="ident">session</span>: <span class="ident">Session</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span><span class="op">></span> {
|
||||
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">logout</span>(<span class="ident">session</span>: <span class="ident">Session</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HttpResponse</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">id</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> <span class="op">=</span> <span class="ident">session</span>.<span class="ident">get</span>(<span class="string">"user_id"</span>)<span class="question-mark">?</span>;
|
||||
|
||||
<span class="kw">let</span> <span class="ident">body</span> <span class="op">=</span> <span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">x</span>) <span class="op">=</span> <span class="ident">id</span> {
|
||||
@ -1209,7 +1209,7 @@
|
||||
.<span class="ident">unwrap</span>()
|
||||
.<span class="ident">clone</span>()
|
||||
.<span class="ident">into_iter</span>()
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="kw">let</span> <span class="ident">result_1</span> <span class="op">=</span> <span class="ident">resp_1</span>.<span class="ident">json</span>::<span class="op"><</span><span class="ident">IndexResponse</span><span class="op">></span>().<span class="kw">await</span>.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
@ -1231,7 +1231,7 @@
|
||||
.<span class="ident">unwrap</span>()
|
||||
.<span class="ident">clone</span>()
|
||||
.<span class="ident">into_iter</span>()
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"test-session"</span>);
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"test-session"</span>);
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">cookie_2</span>, <span class="prelude-val">None</span>);
|
||||
|
||||
<span class="comment">// Step 3: POST to do_something, including session cookie #1 in request</span>
|
||||
@ -1275,7 +1275,7 @@
|
||||
.<span class="ident">unwrap</span>()
|
||||
.<span class="ident">clone</span>()
|
||||
.<span class="ident">into_iter</span>()
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_ne!</span>(<span class="ident">cookie_1</span>.<span class="ident">value</span>(), <span class="ident">cookie_2</span>.<span class="ident">value</span>());
|
||||
|
||||
@ -1325,7 +1325,7 @@
|
||||
.<span class="ident">unwrap</span>()
|
||||
.<span class="ident">clone</span>()
|
||||
.<span class="ident">into_iter</span>()
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="kw">let</span> <span class="ident">result_8</span> <span class="op">=</span> <span class="ident">resp_8</span>.<span class="ident">json</span>::<span class="op"><</span><span class="ident">IndexResponse</span><span class="op">></span>().<span class="kw">await</span>.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
@ -1347,7 +1347,7 @@
|
||||
.<span class="ident">unwrap</span>()
|
||||
.<span class="ident">clone</span>()
|
||||
.<span class="ident">into_iter</span>()
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_ne!</span>(
|
||||
<span class="ident">OffsetDateTime::now_utc</span>().<span class="ident">year</span>(),
|
||||
@ -1376,7 +1376,7 @@
|
||||
.<span class="ident">unwrap</span>()
|
||||
.<span class="ident">clone</span>()
|
||||
.<span class="ident">into_iter</span>()
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_ne!</span>(<span class="ident">cookie_5</span>.<span class="ident">value</span>(), <span class="ident">cookie_2</span>.<span class="ident">value</span>());
|
||||
}
|
||||
@ -1404,7 +1404,7 @@
|
||||
.<span class="ident">unwrap</span>()
|
||||
.<span class="ident">clone</span>()
|
||||
.<span class="ident">into_iter</span>()
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"test-session"</span>)
|
||||
.<span class="ident">unwrap</span>();
|
||||
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">cookie</span>.<span class="ident">max_age</span>(), <span class="prelude-val">None</span>);
|
||||
|
@ -610,7 +610,7 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">CookieSessionInner</span> {
|
||||
<span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>], <span class="ident">security</span>: <span class="ident">CookieSecurity</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSessionInner</span> {
|
||||
<span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>], <span class="ident">security</span>: <span class="ident">CookieSecurity</span>) -> <span class="ident">CookieSessionInner</span> {
|
||||
<span class="ident">CookieSessionInner</span> {
|
||||
<span class="ident">security</span>,
|
||||
<span class="ident">key</span>: <span class="ident">Key::derive_from</span>(<span class="ident">key</span>),
|
||||
@ -630,7 +630,7 @@
|
||||
<span class="kw-2">&</span><span class="self">self</span>,
|
||||
<span class="ident">res</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>,
|
||||
<span class="ident">state</span>: <span class="kw">impl</span> <span class="ident">Iterator</span><span class="op"><</span><span class="ident">Item</span> <span class="op">=</span> (<span class="ident">String</span>, <span class="ident">String</span>)<span class="op">></span>,
|
||||
) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span> {
|
||||
) -> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">state</span>: <span class="ident">HashMap</span><span class="op"><</span><span class="ident">String</span>, <span class="ident">String</span><span class="op">></span> <span class="op">=</span> <span class="ident">state</span>.<span class="ident">collect</span>();
|
||||
|
||||
<span class="kw">if</span> <span class="self">self</span>.<span class="ident">lazy</span> <span class="op">&&</span> <span class="ident">state</span>.<span class="ident">is_empty</span>() {
|
||||
@ -667,8 +667,8 @@
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">jar</span> <span class="op">=</span> <span class="ident">CookieJar::new</span>();
|
||||
|
||||
<span class="kw">match</span> <span class="self">self</span>.<span class="ident">security</span> {
|
||||
<span class="ident">CookieSecurity::Signed</span> <span class="op">=</span><span class="op">></span> <span class="ident">jar</span>.<span class="ident">signed_mut</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">key</span>).<span class="ident">add</span>(<span class="ident">cookie</span>),
|
||||
<span class="ident">CookieSecurity::Private</span> <span class="op">=</span><span class="op">></span> <span class="ident">jar</span>.<span class="ident">private_mut</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">key</span>).<span class="ident">add</span>(<span class="ident">cookie</span>),
|
||||
<span class="ident">CookieSecurity::Signed</span> => <span class="ident">jar</span>.<span class="ident">signed_mut</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">key</span>).<span class="ident">add</span>(<span class="ident">cookie</span>),
|
||||
<span class="ident">CookieSecurity::Private</span> => <span class="ident">jar</span>.<span class="ident">private_mut</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">key</span>).<span class="ident">add</span>(<span class="ident">cookie</span>),
|
||||
}
|
||||
|
||||
<span class="kw">for</span> <span class="ident">cookie</span> <span class="kw">in</span> <span class="ident">jar</span>.<span class="ident">delta</span>() {
|
||||
@ -680,7 +680,7 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// invalidates session cookie</span>
|
||||
<span class="kw">fn</span> <span class="ident">remove_cookie</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">res</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">remove_cookie</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">res</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>) -> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">cookie</span> <span class="op">=</span> <span class="ident">Cookie::named</span>(<span class="self">self</span>.<span class="ident">name</span>.<span class="ident">clone</span>());
|
||||
<span class="ident">cookie</span>.<span class="ident">set_path</span>(<span class="self">self</span>.<span class="ident">path</span>.<span class="ident">clone</span>());
|
||||
<span class="ident">cookie</span>.<span class="ident">set_value</span>(<span class="string">""</span>);
|
||||
@ -693,16 +693,16 @@
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">load</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> (<span class="ident">bool</span>, <span class="ident">HashMap</span><span class="op"><</span><span class="ident">String</span>, <span class="ident">String</span><span class="op">></span>) {
|
||||
<span class="kw">fn</span> <span class="ident">load</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">ServiceRequest</span>) -> (<span class="ident">bool</span>, <span class="ident">HashMap</span><span class="op"><</span><span class="ident">String</span>, <span class="ident">String</span><span class="op">></span>) {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Ok</span>(<span class="ident">cookies</span>) <span class="op">=</span> <span class="ident">req</span>.<span class="ident">cookies</span>() {
|
||||
<span class="kw">for</span> <span class="ident">cookie</span> <span class="kw">in</span> <span class="ident">cookies</span>.<span class="ident">iter</span>() {
|
||||
<span class="kw">if</span> <span class="ident">cookie</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="self">self</span>.<span class="ident">name</span> {
|
||||
<span class="kw">if</span> <span class="ident">cookie</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="self">self</span>.<span class="ident">name</span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">jar</span> <span class="op">=</span> <span class="ident">CookieJar::new</span>();
|
||||
<span class="ident">jar</span>.<span class="ident">add_original</span>(<span class="ident">cookie</span>.<span class="ident">clone</span>());
|
||||
|
||||
<span class="kw">let</span> <span class="ident">cookie_opt</span> <span class="op">=</span> <span class="kw">match</span> <span class="self">self</span>.<span class="ident">security</span> {
|
||||
<span class="ident">CookieSecurity::Signed</span> <span class="op">=</span><span class="op">></span> <span class="ident">jar</span>.<span class="ident">signed</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">key</span>).<span class="ident">get</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">name</span>),
|
||||
<span class="ident">CookieSecurity::Private</span> <span class="op">=</span><span class="op">></span> <span class="ident">jar</span>.<span class="ident">private</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">key</span>).<span class="ident">get</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">name</span>),
|
||||
<span class="ident">CookieSecurity::Signed</span> => <span class="ident">jar</span>.<span class="ident">signed</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">key</span>).<span class="ident">get</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">name</span>),
|
||||
<span class="ident">CookieSecurity::Private</span> => <span class="ident">jar</span>.<span class="ident">private</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">key</span>).<span class="ident">get</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">name</span>),
|
||||
};
|
||||
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">cookie</span>) <span class="op">=</span> <span class="ident">cookie_opt</span> {
|
||||
@ -763,7 +763,7 @@
|
||||
<span class="doccomment">/// Construct new *signed* `CookieSession` instance.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Panics if key length is less than 32 bytes.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">signed</span>(<span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>]) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">signed</span>(<span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>]) -> <span class="ident">CookieSession</span> {
|
||||
<span class="ident">CookieSession</span>(<span class="ident">Rc::new</span>(<span class="ident">CookieSessionInner::new</span>(
|
||||
<span class="ident">key</span>,
|
||||
<span class="ident">CookieSecurity::Signed</span>,
|
||||
@ -773,7 +773,7 @@
|
||||
<span class="doccomment">/// Construct new *private* `CookieSession` instance.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Panics if key length is less than 32 bytes.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">private</span>(<span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>]) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">private</span>(<span class="ident">key</span>: <span class="kw-2">&</span>[<span class="ident">u8</span>]) -> <span class="ident">CookieSession</span> {
|
||||
<span class="ident">CookieSession</span>(<span class="ident">Rc::new</span>(<span class="ident">CookieSessionInner::new</span>(
|
||||
<span class="ident">key</span>,
|
||||
<span class="ident">CookieSecurity::Private</span>,
|
||||
@ -781,19 +781,19 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `path` field in the session cookie being built.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">path</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">S</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">path</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">S</span>) -> <span class="ident">CookieSession</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">path</span> <span class="op">=</span> <span class="ident">value</span>.<span class="ident">into</span>();
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `name` field in the session cookie being built.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">name</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">S</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">name</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">S</span>) -> <span class="ident">CookieSession</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">name</span> <span class="op">=</span> <span class="ident">value</span>.<span class="ident">into</span>();
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `domain` field in the session cookie being built.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">domain</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">S</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">domain</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">S</span>) -> <span class="ident">CookieSession</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">domain</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">value</span>.<span class="ident">into</span>());
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -802,7 +802,7 @@
|
||||
<span class="doccomment">/// the session contains data. Default is `false`.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Useful when trying to comply with laws that require consent for setting cookies.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">lazy</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">bool</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">lazy</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">bool</span>) -> <span class="ident">CookieSession</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">lazy</span> <span class="op">=</span> <span class="ident">value</span>;
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -811,41 +811,41 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// If the `secure` field is set, a cookie will only be transmitted when the</span>
|
||||
<span class="doccomment">/// connection is secure - i.e. `https`</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">secure</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">bool</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">secure</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">bool</span>) -> <span class="ident">CookieSession</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">secure</span> <span class="op">=</span> <span class="ident">value</span>;
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `http_only` field in the session cookie being built.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">http_only</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">bool</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">http_only</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">bool</span>) -> <span class="ident">CookieSession</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">http_only</span> <span class="op">=</span> <span class="ident">value</span>;
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `same_site` field in the session cookie being built.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">same_site</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">SameSite</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">same_site</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">SameSite</span>) -> <span class="ident">CookieSession</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">same_site</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">value</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `max-age` field in the session cookie being built.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">max_age</span>(<span class="self">self</span>, <span class="ident">seconds</span>: <span class="ident">i64</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">max_age</span>(<span class="self">self</span>, <span class="ident">seconds</span>: <span class="ident">i64</span>) -> <span class="ident">CookieSession</span> {
|
||||
<span class="self">self</span>.<span class="ident">max_age_time</span>(<span class="ident">Duration::seconds</span>(<span class="ident">seconds</span>))
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `max-age` field in the session cookie being built.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">max_age_time</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">time::Duration</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">max_age_time</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">time::Duration</span>) -> <span class="ident">CookieSession</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">max_age</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">value</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `expires` field in the session cookie being built.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">expires_in</span>(<span class="self">self</span>, <span class="ident">seconds</span>: <span class="ident">i64</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">expires_in</span>(<span class="self">self</span>, <span class="ident">seconds</span>: <span class="ident">i64</span>) -> <span class="ident">CookieSession</span> {
|
||||
<span class="self">self</span>.<span class="ident">expires_in_time</span>(<span class="ident">Duration::seconds</span>(<span class="ident">seconds</span>))
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Sets the `expires` field in the session cookie being built.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">expires_in_time</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">Duration</span>) <span class="op">-</span><span class="op">></span> <span class="ident">CookieSession</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">expires_in_time</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">Duration</span>) -> <span class="ident">CookieSession</span> {
|
||||
<span class="ident">Rc::get_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>).<span class="ident">unwrap</span>().<span class="ident">expires_in</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">value</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -865,7 +865,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Transform</span> <span class="op">=</span> <span class="ident">CookieSessionMiddleware</span><span class="op"><</span><span class="ident">S</span><span class="op">></span>;
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Transform</span>, <span class="ident"><span class="self">Self</span>::InitError</span><span class="op">></span><span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">new_transform</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">service</span>: <span class="ident">S</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">new_transform</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">service</span>: <span class="ident">S</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="ident">ok</span>(<span class="ident">CookieSessionMiddleware</span> {
|
||||
<span class="ident">service</span>,
|
||||
<span class="ident">inner</span>: <span class="self">self</span>.<span class="number">0</span>.<span class="ident">clone</span>(),
|
||||
@ -898,7 +898,7 @@
|
||||
<span class="doccomment">/// session state changes, then set-cookie is returned in response. As</span>
|
||||
<span class="doccomment">/// a user logs out, call session.purge() to set SessionStatus accordingly</span>
|
||||
<span class="doccomment">/// and this will trigger removal of the session cookie in the response.</span>
|
||||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="kw-2">mut</span> <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="kw-2">mut</span> <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">let</span> <span class="ident">inner</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">inner</span>.<span class="ident">clone</span>();
|
||||
<span class="kw">let</span> (<span class="ident">is_new</span>, <span class="ident">state</span>) <span class="op">=</span> <span class="self">self</span>.<span class="ident">inner</span>.<span class="ident">load</span>(<span class="kw-2">&</span><span class="ident">req</span>);
|
||||
<span class="kw">let</span> <span class="ident">prolong_expiration</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">inner</span>.<span class="ident">expires_in</span>.<span class="ident">is_some</span>();
|
||||
@ -910,16 +910,16 @@
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">fut</span>.<span class="kw">await</span><span class="question-mark">?</span>;
|
||||
|
||||
<span class="kw">let</span> <span class="ident">result</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">Session::get_changes</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">res</span>) {
|
||||
(<span class="ident">SessionStatus::Changed</span>, <span class="ident">state</span>) <span class="op">|</span> (<span class="ident">SessionStatus::Renewed</span>, <span class="ident">state</span>) <span class="op">=</span><span class="op">></span> {
|
||||
(<span class="ident">SessionStatus::Changed</span>, <span class="ident">state</span>) <span class="op">|</span> (<span class="ident">SessionStatus::Renewed</span>, <span class="ident">state</span>) => {
|
||||
<span class="ident">inner</span>.<span class="ident">set_cookie</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">res</span>, <span class="ident">state</span>)
|
||||
}
|
||||
|
||||
(<span class="ident">SessionStatus::Unchanged</span>, <span class="ident">state</span>) <span class="kw">if</span> <span class="ident">prolong_expiration</span> <span class="op">=</span><span class="op">></span> {
|
||||
(<span class="ident">SessionStatus::Unchanged</span>, <span class="ident">state</span>) <span class="kw">if</span> <span class="ident">prolong_expiration</span> => {
|
||||
<span class="ident">inner</span>.<span class="ident">set_cookie</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">res</span>, <span class="ident">state</span>)
|
||||
}
|
||||
|
||||
<span class="comment">// set a new session cookie upon first request (new client)</span>
|
||||
(<span class="ident">SessionStatus::Unchanged</span>, <span class="kw">_</span>) <span class="op">=</span><span class="op">></span> {
|
||||
(<span class="ident">SessionStatus::Unchanged</span>, <span class="kw">_</span>) => {
|
||||
<span class="kw">if</span> <span class="ident">is_new</span> {
|
||||
<span class="kw">let</span> <span class="ident">state</span>: <span class="ident">HashMap</span><span class="op"><</span><span class="ident">String</span>, <span class="ident">String</span><span class="op">></span> <span class="op">=</span> <span class="ident">HashMap::new</span>();
|
||||
<span class="ident">inner</span>.<span class="ident">set_cookie</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">res</span>, <span class="ident">state</span>.<span class="ident">into_iter</span>())
|
||||
@ -928,15 +928,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
(<span class="ident">SessionStatus::Purged</span>, <span class="kw">_</span>) <span class="op">=</span><span class="op">></span> {
|
||||
(<span class="ident">SessionStatus::Purged</span>, <span class="kw">_</span>) => {
|
||||
<span class="kw">let</span> <span class="kw">_</span> <span class="op">=</span> <span class="ident">inner</span>.<span class="ident">remove_cookie</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">res</span>);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
};
|
||||
|
||||
<span class="kw">match</span> <span class="ident">result</span> {
|
||||
<span class="prelude-val">Ok</span>(()) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(<span class="ident">res</span>.<span class="ident">map_body</span>(<span class="op">|</span><span class="kw">_</span>, <span class="ident">body</span><span class="op">|</span> <span class="ident">AnyBody::from_message</span>(<span class="ident">body</span>))),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(<span class="ident">res</span>.<span class="ident">error_response</span>(<span class="ident">error</span>)),
|
||||
<span class="prelude-val">Ok</span>(()) => <span class="prelude-val">Ok</span>(<span class="ident">res</span>.<span class="ident">map_body</span>(<span class="op">|</span><span class="kw">_</span>, <span class="ident">body</span><span class="op">|</span> <span class="ident">AnyBody::from_message</span>(<span class="ident">body</span>))),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">error</span>) => <span class="prelude-val">Ok</span>(<span class="ident">res</span>.<span class="ident">error_response</span>(<span class="ident">error</span>)),
|
||||
}
|
||||
}
|
||||
.<span class="ident">boxed_local</span>()
|
||||
@ -966,7 +966,7 @@
|
||||
<span class="macro">assert!</span>(<span class="ident">response</span>
|
||||
.<span class="ident">response</span>()
|
||||
.<span class="ident">cookies</span>()
|
||||
.<span class="ident">any</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"actix-session"</span>));
|
||||
.<span class="ident">any</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"actix-session"</span>));
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">actix_rt::test</span>]</span>
|
||||
@ -986,7 +986,7 @@
|
||||
<span class="macro">assert!</span>(<span class="ident">response</span>
|
||||
.<span class="ident">response</span>()
|
||||
.<span class="ident">cookies</span>()
|
||||
.<span class="ident">any</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"actix-session"</span>));
|
||||
.<span class="ident">any</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"actix-session"</span>));
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">actix_rt::test</span>]</span>
|
||||
@ -1004,7 +1004,7 @@
|
||||
|
||||
<span class="kw">let</span> <span class="ident">request</span> <span class="op">=</span> <span class="ident">test::TestRequest::get</span>().<span class="ident">to_request</span>();
|
||||
<span class="kw">let</span> <span class="ident">response</span> <span class="op">=</span> <span class="ident">app</span>.<span class="ident">call</span>(<span class="ident">request</span>).<span class="kw">await</span>.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="ident">response</span>.<span class="ident">response</span>().<span class="ident">cookies</span>().<span class="ident">count</span>() <span class="op">=</span><span class="op">=</span> <span class="number">0</span>);
|
||||
<span class="macro">assert!</span>(<span class="ident">response</span>.<span class="ident">response</span>().<span class="ident">cookies</span>().<span class="ident">count</span>() <span class="op">==</span> <span class="number">0</span>);
|
||||
|
||||
<span class="kw">let</span> <span class="ident">request</span> <span class="op">=</span> <span class="ident">test::TestRequest::with_uri</span>(<span class="string">"/count"</span>).<span class="ident">to_request</span>();
|
||||
<span class="kw">let</span> <span class="ident">response</span> <span class="op">=</span> <span class="ident">app</span>.<span class="ident">call</span>(<span class="ident">request</span>).<span class="kw">await</span>.<span class="ident">unwrap</span>();
|
||||
@ -1012,7 +1012,7 @@
|
||||
<span class="macro">assert!</span>(<span class="ident">response</span>
|
||||
.<span class="ident">response</span>()
|
||||
.<span class="ident">cookies</span>()
|
||||
.<span class="ident">any</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"actix-session"</span>));
|
||||
.<span class="ident">any</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"actix-session"</span>));
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">actix_rt::test</span>]</span>
|
||||
@ -1032,7 +1032,7 @@
|
||||
<span class="macro">assert!</span>(<span class="ident">response</span>
|
||||
.<span class="ident">response</span>()
|
||||
.<span class="ident">cookies</span>()
|
||||
.<span class="ident">any</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"actix-session"</span>));
|
||||
.<span class="ident">any</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"actix-session"</span>));
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">actix_rt::test</span>]</span>
|
||||
@ -1064,7 +1064,7 @@
|
||||
<span class="kw">let</span> <span class="ident">cookie</span> <span class="op">=</span> <span class="ident">response</span>
|
||||
.<span class="ident">response</span>()
|
||||
.<span class="ident">cookies</span>()
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"actix-test"</span>)
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"actix-test"</span>)
|
||||
.<span class="ident">unwrap</span>()
|
||||
.<span class="ident">clone</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">cookie</span>.<span class="ident">path</span>().<span class="ident">unwrap</span>(), <span class="string">"/test/"</span>);
|
||||
@ -1094,7 +1094,7 @@
|
||||
<span class="kw">let</span> <span class="ident">expires_1</span> <span class="op">=</span> <span class="ident">response</span>
|
||||
.<span class="ident">response</span>()
|
||||
.<span class="ident">cookies</span>()
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"actix-session"</span>)
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"actix-session"</span>)
|
||||
.<span class="ident">expect</span>(<span class="string">"Cookie is set"</span>)
|
||||
.<span class="ident">expires</span>()
|
||||
.<span class="ident">expect</span>(<span class="string">"Expiration is set"</span>)
|
||||
@ -1108,7 +1108,7 @@
|
||||
<span class="kw">let</span> <span class="ident">expires_2</span> <span class="op">=</span> <span class="ident">response</span>
|
||||
.<span class="ident">response</span>()
|
||||
.<span class="ident">cookies</span>()
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">=</span><span class="op">=</span> <span class="string">"actix-session"</span>)
|
||||
.<span class="ident">find</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="ident">c</span>.<span class="ident">name</span>() <span class="op">==</span> <span class="string">"actix-session"</span>)
|
||||
.<span class="ident">expect</span>(<span class="string">"Cookie is set"</span>)
|
||||
.<span class="ident">expires</span>()
|
||||
.<span class="ident">expect</span>(<span class="string">"Expiration is set"</span>)
|
||||
|
@ -487,23 +487,23 @@
|
||||
<span class="doccomment">/// Extraction of a [`Session`] object.</span>
|
||||
<span class="kw">pub</span> <span class="kw">trait</span> <span class="ident">UserSession</span> {
|
||||
<span class="doccomment">/// Extract the [`Session`] object</span>
|
||||
<span class="kw">fn</span> <span class="ident">get_session</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Session</span>;
|
||||
<span class="kw">fn</span> <span class="ident">get_session</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">Session</span>;
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">UserSession</span> <span class="kw">for</span> <span class="ident">HttpRequest</span> {
|
||||
<span class="kw">fn</span> <span class="ident">get_session</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Session</span> {
|
||||
<span class="kw">fn</span> <span class="ident">get_session</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">Session</span> {
|
||||
<span class="ident">Session::get_session</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="kw-2">*</span><span class="self">self</span>.<span class="ident">extensions_mut</span>())
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">UserSession</span> <span class="kw">for</span> <span class="ident">ServiceRequest</span> {
|
||||
<span class="kw">fn</span> <span class="ident">get_session</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Session</span> {
|
||||
<span class="kw">fn</span> <span class="ident">get_session</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">Session</span> {
|
||||
<span class="ident">Session::get_session</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="kw-2">*</span><span class="self">self</span>.<span class="ident">extensions_mut</span>())
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">UserSession</span> <span class="kw">for</span> <span class="ident">RequestHead</span> {
|
||||
<span class="kw">fn</span> <span class="ident">get_session</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Session</span> {
|
||||
<span class="kw">fn</span> <span class="ident">get_session</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">Session</span> {
|
||||
<span class="ident">Session::get_session</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="kw-2">*</span><span class="self">self</span>.<span class="ident">extensions_mut</span>())
|
||||
}
|
||||
}
|
||||
@ -534,7 +534,7 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Default</span> <span class="kw">for</span> <span class="ident">SessionStatus</span> {
|
||||
<span class="kw">fn</span> <span class="ident">default</span>() <span class="op">-</span><span class="op">></span> <span class="ident">SessionStatus</span> {
|
||||
<span class="kw">fn</span> <span class="ident">default</span>() -> <span class="ident">SessionStatus</span> {
|
||||
<span class="ident">SessionStatus::Unchanged</span>
|
||||
}
|
||||
}
|
||||
@ -547,7 +547,7 @@
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Session</span> {
|
||||
<span class="doccomment">/// Get a `value` from the session.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">get</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">DeserializeOwned</span><span class="op">></span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">key</span>: <span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>, <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">get</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">DeserializeOwned</span><span class="op">></span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">key</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>, <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">s</span>) <span class="op">=</span> <span class="self">self</span>.<span class="number">0</span>.<span class="ident">borrow</span>().<span class="ident">state</span>.<span class="ident">get</span>(<span class="ident">key</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="prelude-val">Some</span>(<span class="ident">serde_json::from_str</span>(<span class="ident">s</span>)<span class="question-mark">?</span>))
|
||||
} <span class="kw">else</span> {
|
||||
@ -558,7 +558,7 @@
|
||||
<span class="doccomment">/// Get all raw key-value data from the session.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Note that values are JSON encoded.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">entries</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Ref</span><span class="op"><</span><span class="lifetime">'_</span>, <span class="ident">HashMap</span><span class="op"><</span><span class="ident">String</span>, <span class="ident">String</span><span class="op">></span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">entries</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">Ref</span><span class="op"><</span><span class="lifetime">'_</span>, <span class="ident">HashMap</span><span class="op"><</span><span class="ident">String</span>, <span class="ident">String</span><span class="op">></span><span class="op">></span> {
|
||||
<span class="ident">Ref::map</span>(<span class="self">self</span>.<span class="number">0</span>.<span class="ident">borrow</span>(), <span class="op">|</span><span class="ident">inner</span><span class="op">|</span> <span class="kw-2">&</span><span class="ident">inner</span>.<span class="ident">state</span>)
|
||||
}
|
||||
|
||||
@ -566,7 +566,7 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Any serializable value can be used and will be encoded as JSON in session data, hence why</span>
|
||||
<span class="doccomment">/// only a reference to the value is taken.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">insert</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">key</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>, <span class="ident">value</span>: <span class="kw">impl</span> <span class="ident">Serialize</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">insert</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">key</span>: <span class="kw">impl</span> <span class="ident">Into</span><span class="op"><</span><span class="ident">String</span><span class="op">></span>, <span class="ident">value</span>: <span class="kw">impl</span> <span class="ident">Serialize</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">Error</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">inner</span> <span class="op">=</span> <span class="self">self</span>.<span class="number">0</span>.<span class="ident">borrow_mut</span>();
|
||||
|
||||
<span class="kw">if</span> <span class="ident">inner</span>.<span class="ident">status</span> <span class="op">!</span><span class="op">=</span> <span class="ident">SessionStatus::Purged</span> {
|
||||
@ -581,7 +581,7 @@
|
||||
<span class="doccomment">/// Remove value from the session.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// If present, the JSON encoded value is returned.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">remove</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">key</span>: <span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">remove</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">key</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">String</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">inner</span> <span class="op">=</span> <span class="self">self</span>.<span class="number">0</span>.<span class="ident">borrow_mut</span>();
|
||||
|
||||
<span class="kw">if</span> <span class="ident">inner</span>.<span class="ident">status</span> <span class="op">!</span><span class="op">=</span> <span class="ident">SessionStatus::Purged</span> {
|
||||
@ -596,11 +596,11 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Returns None if key was not present in session. Returns T if deserialization succeeds,</span>
|
||||
<span class="doccomment">/// otherwise returns un-deserialized JSON string.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">remove_as</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">DeserializeOwned</span><span class="op">></span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">key</span>: <span class="kw-2">&</span><span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">T</span>, <span class="ident">String</span><span class="op">></span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">remove_as</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">DeserializeOwned</span><span class="op">></span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">key</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">T</span>, <span class="ident">String</span><span class="op">></span><span class="op">></span> {
|
||||
<span class="self">self</span>.<span class="ident">remove</span>(<span class="ident">key</span>)
|
||||
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">val_str</span><span class="op">|</span> <span class="kw">match</span> <span class="ident">serde_json::from_str</span>(<span class="kw-2">&</span><span class="ident">val_str</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">val</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Ok</span>(<span class="ident">val</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">_err</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">val</span>) => <span class="prelude-val">Ok</span>(<span class="ident">val</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">_err</span>) => {
|
||||
<span class="macro">log::debug!</span>(
|
||||
<span class="string">"removed value (key: {}) could not be deserialized as {}"</span>,
|
||||
<span class="ident">key</span>,
|
||||
@ -662,7 +662,7 @@
|
||||
<span class="doccomment">/// Returns session status and iterator of key-value pairs of changes.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">get_changes</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>(
|
||||
<span class="ident">res</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>,
|
||||
) <span class="op">-</span><span class="op">></span> (<span class="ident">SessionStatus</span>, <span class="kw">impl</span> <span class="ident">Iterator</span><span class="op"><</span><span class="ident">Item</span> <span class="op">=</span> (<span class="ident">String</span>, <span class="ident">String</span>)<span class="op">></span>) {
|
||||
) -> (<span class="ident">SessionStatus</span>, <span class="kw">impl</span> <span class="ident">Iterator</span><span class="op"><</span><span class="ident">Item</span> <span class="op">=</span> (<span class="ident">String</span>, <span class="ident">String</span>)<span class="op">></span>) {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">s_impl</span>) <span class="op">=</span> <span class="ident">res</span>
|
||||
.<span class="ident">request</span>()
|
||||
.<span class="ident">extensions</span>()
|
||||
@ -675,7 +675,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">get_session</span>(<span class="ident">extensions</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Extensions</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Session</span> {
|
||||
<span class="kw">fn</span> <span class="ident">get_session</span>(<span class="ident">extensions</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Extensions</span>) -> <span class="ident">Session</span> {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">s_impl</span>) <span class="op">=</span> <span class="ident">extensions</span>.<span class="ident">get</span>::<span class="op"><</span><span class="ident">Rc</span><span class="op"><</span><span class="ident">RefCell</span><span class="op"><</span><span class="ident">SessionInner</span><span class="op">></span><span class="op">></span><span class="op">></span>() {
|
||||
<span class="kw">return</span> <span class="ident">Session</span>(<span class="ident">Rc::clone</span>(<span class="ident">s_impl</span>));
|
||||
}
|
||||
@ -711,7 +711,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Config</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="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</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="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="ident">ok</span>(<span class="ident">Session::get_session</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="kw-2">*</span><span class="ident">req</span>.<span class="ident">extensions_mut</span>()))
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// The "realm" attribute indicates the scope of protection in the manner</span>
|
||||
<span class="doccomment">/// described in HTTP/1.1 [RFC2617](https://tools.ietf.org/html/rfc2617#section-1.2).</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">realm</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Config</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">realm</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) -> <span class="ident">Config</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
@ -186,7 +186,7 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">AsRef</span><span class="op"><</span><span class="ident">Challenge</span><span class="op">></span> <span class="kw">for</span> <span class="ident">Config</span> {
|
||||
<span class="kw">fn</span> <span class="ident">as_ref</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="ident">Challenge</span> {
|
||||
<span class="kw">fn</span> <span class="ident">as_ref</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw-2">&</span><span class="ident">Challenge</span> {
|
||||
<span class="kw-2">&</span><span class="self">self</span>.<span class="number">0</span>
|
||||
}
|
||||
}
|
||||
@ -194,7 +194,7 @@
|
||||
<span class="kw">impl</span> <span class="ident">AuthExtractorConfig</span> <span class="kw">for</span> <span class="ident">Config</span> {
|
||||
<span class="kw">type</span> <span class="ident">Inner</span> <span class="op">=</span> <span class="ident">Challenge</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">into_inner</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Inner</span> {
|
||||
<span class="kw">fn</span> <span class="ident">into_inner</span>(<span class="self">self</span>) -> <span class="ident"><span class="self">Self</span>::Inner</span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>
|
||||
}
|
||||
}
|
||||
@ -242,12 +242,12 @@
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">BasicAuth</span> {
|
||||
<span class="doccomment">/// Returns client's user-ID.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">user_id</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">user_id</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw-2">&</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>.<span class="ident">user_id</span>()
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Returns client's password.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">password</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">password</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>.<span class="ident">password</span>()
|
||||
}
|
||||
}
|
||||
@ -257,7 +257,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Config</span> <span class="op">=</span> <span class="ident">Config</span>;
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">AuthenticationError</span><span class="op"><</span><span class="ident">Challenge</span><span class="op">></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="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) <span class="op">-</span><span class="op">></span> <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">FromRequest</span><span class="op">></span><span class="ident">::Future</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="kw">_</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) -> <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">FromRequest</span><span class="op">></span><span class="ident">::Future</span> {
|
||||
<span class="ident">ready</span>(
|
||||
<span class="ident">Authorization</span>::<span class="op"><</span><span class="ident">Basic</span><span class="op">></span><span class="ident">::parse</span>(<span class="ident">req</span>)
|
||||
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">auth</span><span class="op">|</span> <span class="ident">BasicAuth</span>(<span class="ident">auth</span>.<span class="ident">into_scheme</span>()))
|
||||
@ -279,7 +279,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">AuthenticationError</span><span class="op"><</span><span class="ident">Challenge</span><span class="op">></span>;
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident"><span class="self">Self</span>::Error</span><span class="op">></span><span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">from_service_request</span>(<span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from_service_request</span>(<span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">ServiceRequest</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="ident">ready</span>(
|
||||
<span class="ident">Authorization</span>::<span class="op"><</span><span class="ident">Basic</span><span class="op">></span><span class="ident">::parse</span>(<span class="ident">req</span>)
|
||||
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">auth</span><span class="op">|</span> <span class="ident">BasicAuth</span>(<span class="ident">auth</span>.<span class="ident">into_scheme</span>()))
|
||||
|
@ -202,7 +202,7 @@
|
||||
<span class="doccomment">/// The `"scope"` attribute is a space-delimited list of case-sensitive</span>
|
||||
<span class="doccomment">/// scope values indicating the required scope of the access token for</span>
|
||||
<span class="doccomment">/// accessing the requested resource.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">scope</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Config</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">scope</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) -> <span class="ident">Config</span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>.<span class="ident">scope</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">value</span>.<span class="ident">into</span>());
|
||||
<span class="self">self</span>
|
||||
}
|
||||
@ -211,14 +211,14 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// The "realm" attribute indicates the scope of protection in the manner</span>
|
||||
<span class="doccomment">/// described in HTTP/1.1 [RFC2617](https://tools.ietf.org/html/rfc2617#section-1.2).</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">realm</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Config</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">realm</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) -> <span class="ident">Config</span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>.<span class="ident">realm</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">value</span>.<span class="ident">into</span>());
|
||||
<span class="self">self</span>
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">AsRef</span><span class="op"><</span><span class="ident">bearer::Bearer</span><span class="op">></span> <span class="kw">for</span> <span class="ident">Config</span> {
|
||||
<span class="kw">fn</span> <span class="ident">as_ref</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="ident">bearer::Bearer</span> {
|
||||
<span class="kw">fn</span> <span class="ident">as_ref</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw-2">&</span><span class="ident">bearer::Bearer</span> {
|
||||
<span class="kw-2">&</span><span class="self">self</span>.<span class="number">0</span>
|
||||
}
|
||||
}
|
||||
@ -226,7 +226,7 @@
|
||||
<span class="kw">impl</span> <span class="ident">AuthExtractorConfig</span> <span class="kw">for</span> <span class="ident">Config</span> {
|
||||
<span class="kw">type</span> <span class="ident">Inner</span> <span class="op">=</span> <span class="ident">bearer::Bearer</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">into_inner</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Inner</span> {
|
||||
<span class="kw">fn</span> <span class="ident">into_inner</span>(<span class="self">self</span>) -> <span class="ident"><span class="self">Self</span>::Inner</span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>
|
||||
}
|
||||
}
|
||||
@ -274,7 +274,7 @@
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">BearerAuth</span> {
|
||||
<span class="doccomment">/// Returns bearer token provided by client.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">token</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="ident">str</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">token</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw-2">&</span><span class="ident">str</span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>.<span class="ident">token</span>()
|
||||
}
|
||||
}
|
||||
@ -284,7 +284,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident"><span class="self">Self</span>::Error</span><span class="op">></span><span class="op">></span>;
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">AuthenticationError</span><span class="op"><</span><span class="ident">bearer::Bearer</span><span class="op">></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="ident">_payload</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) <span class="op">-</span><span class="op">></span> <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">FromRequest</span><span class="op">></span><span class="ident">::Future</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="ident">_payload</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Payload</span>) -> <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">FromRequest</span><span class="op">></span><span class="ident">::Future</span> {
|
||||
<span class="ident">ready</span>(
|
||||
<span class="ident">authorization::Authorization</span>::<span class="op"><</span><span class="ident">authorization::Bearer</span><span class="op">></span><span class="ident">::parse</span>(<span class="ident">req</span>)
|
||||
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">auth</span><span class="op">|</span> <span class="ident">BearerAuth</span>(<span class="ident">auth</span>.<span class="ident">into_scheme</span>()))
|
||||
@ -304,7 +304,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident"><span class="self">Self</span>::Error</span><span class="op">></span><span class="op">></span>;
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">AuthenticationError</span><span class="op"><</span><span class="ident">bearer::Bearer</span><span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">from_service_request</span>(<span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from_service_request</span>(<span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">ServiceRequest</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="ident">ready</span>(
|
||||
<span class="ident">authorization::Authorization</span>::<span class="op"><</span><span class="ident">authorization::Bearer</span><span class="op">></span><span class="ident">::parse</span>(<span class="ident">req</span>)
|
||||
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">auth</span><span class="op">|</span> <span class="ident">BearerAuth</span>(<span class="ident">auth</span>.<span class="ident">into_scheme</span>()))
|
||||
@ -326,14 +326,14 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Error status code will be changed to the one provided by the `kind`</span>
|
||||
<span class="doccomment">/// Error.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">with_error</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">kind</span>: <span class="ident">Error</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">with_error</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">kind</span>: <span class="ident">Error</span>) -> <span class="self">Self</span> {
|
||||
<span class="kw-2">*</span><span class="self">self</span>.<span class="ident">status_code_mut</span>() <span class="op">=</span> <span class="ident">kind</span>.<span class="ident">status_code</span>();
|
||||
<span class="self">self</span>.<span class="ident">challenge_mut</span>().<span class="ident">error</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">kind</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Attach error description to the current Authentication error.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">with_error_description</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">desc</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">with_error_description</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">desc</span>: <span class="ident">T</span>) -> <span class="self">Self</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
@ -344,7 +344,7 @@
|
||||
<span class="doccomment">/// Attach error URI to the current Authentication error.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// It is up to implementor to provide properly formed absolute URI.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">with_error_uri</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">uri</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">with_error_uri</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">uri</span>: <span class="ident">T</span>) -> <span class="self">Self</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
|
@ -33,14 +33,14 @@
|
||||
<span class="kw">type</span> <span class="ident">Inner</span>: <span class="ident">Challenge</span>;
|
||||
|
||||
<span class="doccomment">/// Convert the config instance into a HTTP challenge.</span>
|
||||
<span class="kw">fn</span> <span class="ident">into_inner</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Inner</span>;
|
||||
<span class="kw">fn</span> <span class="ident">into_inner</span>(<span class="self">self</span>) -> <span class="ident"><span class="self">Self</span>::Inner</span>;
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> <span class="ident">From</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> <span class="kw">for</span> <span class="ident">AuthenticationError</span><span class="op"><</span><span class="op"><</span><span class="ident">T</span> <span class="kw">as</span> <span class="ident">AuthExtractorConfig</span><span class="op">></span><span class="ident">::Inner</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">AuthExtractorConfig</span>,
|
||||
{
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">config</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">config</span>: <span class="ident">T</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">AuthenticationError::new</span>(<span class="ident">config</span>.<span class="ident">into_inner</span>())
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@
|
||||
<span class="doccomment">/// Creates new authentication error from the provided `challenge`.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// By default returned error will resolve into the `HTTP 401` status code.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">challenge</span>: <span class="ident">C</span>) <span class="op">-</span><span class="op">></span> <span class="ident">AuthenticationError</span><span class="op"><</span><span class="ident">C</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">challenge</span>: <span class="ident">C</span>) -> <span class="ident">AuthenticationError</span><span class="op"><</span><span class="ident">C</span><span class="op">></span> {
|
||||
<span class="ident">AuthenticationError</span> {
|
||||
<span class="ident">challenge</span>,
|
||||
<span class="ident">status_code</span>: <span class="ident">StatusCode::UNAUTHORIZED</span>,
|
||||
@ -111,7 +111,7 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Returns mutable reference to the inner challenge instance.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">challenge_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">C</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">challenge_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">C</span> {
|
||||
<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">challenge</span>
|
||||
}
|
||||
|
||||
@ -119,13 +119,13 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// Can be used to override returned status code, but by default</span>
|
||||
<span class="doccomment">/// this lib tries to stick to the RFC, so it might be unreasonable.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">status_code_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">StatusCode</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">status_code_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">StatusCode</span> {
|
||||
<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="ident">status_code</span>
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">C</span>: <span class="ident">Challenge</span><span class="op">></span> <span class="ident">fmt::Display</span> <span class="kw">for</span> <span class="ident">AuthenticationError</span><span class="op"><</span><span class="ident">C</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="ident">fmt::Display::fmt</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">status_code</span>, <span class="ident">f</span>)
|
||||
}
|
||||
}
|
||||
@ -133,14 +133,14 @@
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">C</span>: <span class="lifetime">'static</span> <span class="op">+</span> <span class="ident">Challenge</span><span class="op">></span> <span class="ident">Error</span> <span class="kw">for</span> <span class="ident">AuthenticationError</span><span class="op"><</span><span class="ident">C</span><span class="op">></span> {}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">C</span>: <span class="lifetime">'static</span> <span class="op">+</span> <span class="ident">Challenge</span><span class="op">></span> <span class="ident">ResponseError</span> <span class="kw">for</span> <span class="ident">AuthenticationError</span><span class="op"><</span><span class="ident">C</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">error_response</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">HttpResponse</span> {
|
||||
<span class="kw">fn</span> <span class="ident">error_response</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">HttpResponse</span> {
|
||||
<span class="ident">HttpResponse::build</span>(<span class="self">self</span>.<span class="ident">status_code</span>)
|
||||
<span class="comment">// TODO: Get rid of the `.clone()`</span>
|
||||
.<span class="ident">insert_header</span>(<span class="ident">WwwAuthenticate</span>(<span class="self">self</span>.<span class="ident">challenge</span>.<span class="ident">clone</span>()))
|
||||
.<span class="ident">finish</span>()
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">status_code</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">StatusCode</span> {
|
||||
<span class="kw">fn</span> <span class="ident">status_code</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">StatusCode</span> {
|
||||
<span class="self">self</span>.<span class="ident">status_code</span>
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@
|
||||
<span class="kw">type</span> <span class="ident">Future</span>: <span class="ident">Future</span><span class="op"><</span><span class="ident">Output</span> <span class="op">=</span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident"><span class="self">Self</span>::Error</span><span class="op">></span><span class="op">></span>;
|
||||
|
||||
<span class="doccomment">/// Parse the authentication credentials from the actix' `ServiceRequest`.</span>
|
||||
<span class="kw">fn</span> <span class="ident">from_service_request</span>(<span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span>;
|
||||
<span class="kw">fn</span> <span class="ident">from_service_request</span>(<span class="ident">req</span>: <span class="kw-2">&</span><span class="ident">ServiceRequest</span>) -> <span class="ident"><span class="self">Self</span>::Future</span>;
|
||||
}
|
||||
</code></pre></div>
|
||||
</section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../search-index.js" data-search-js="../../../search.js"></div>
|
||||
|
@ -95,44 +95,44 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">fmt::Display</span> <span class="kw">for</span> <span class="ident">ParseError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">let</span> <span class="ident">display</span> <span class="op">=</span> <span class="kw">match</span> <span class="self">self</span> {
|
||||
<span class="ident">ParseError::Invalid</span> <span class="op">=</span><span class="op">></span> <span class="string">"Invalid header value"</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::MissingScheme</span> <span class="op">=</span><span class="op">></span> <span class="string">"Missing authorization scheme"</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></span> <span class="string">"Missing header field"</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">></span> <span class="ident">e</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::Base64DecodeError</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">></span> <span class="ident">e</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">></span> <span class="ident">e</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::Invalid</span> => <span class="string">"Invalid header value"</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::MissingScheme</span> => <span class="string">"Missing authorization scheme"</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) => <span class="string">"Missing header field"</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</span>) => <span class="ident">e</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::Base64DecodeError</span>(<span class="ident">e</span>) => <span class="ident">e</span>.<span class="ident">to_string</span>(),
|
||||
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>) => <span class="ident">e</span>.<span class="ident">to_string</span>(),
|
||||
};
|
||||
<span class="ident">f</span>.<span class="ident">write_str</span>(<span class="kw-2">&</span><span class="ident">display</span>)
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Error</span> <span class="kw">for</span> <span class="ident">ParseError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">source</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span>(<span class="kw">dyn</span> <span class="ident">Error</span> <span class="op">+</span> <span class="lifetime">'static</span>)<span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">source</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span>(<span class="kw">dyn</span> <span class="ident">Error</span> <span class="op">+</span> <span class="lifetime">'static</span>)<span class="op">></span> {
|
||||
<span class="kw">match</span> <span class="self">self</span> {
|
||||
<span class="ident">ParseError::Invalid</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">None</span>,
|
||||
<span class="ident">ParseError::MissingScheme</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">None</span>,
|
||||
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">None</span>,
|
||||
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Some</span>(<span class="ident">e</span>),
|
||||
<span class="ident">ParseError::Base64DecodeError</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Some</span>(<span class="ident">e</span>),
|
||||
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>) <span class="op">=</span><span class="op">></span> <span class="prelude-val">Some</span>(<span class="ident">e</span>),
|
||||
<span class="ident">ParseError::Invalid</span> => <span class="prelude-val">None</span>,
|
||||
<span class="ident">ParseError::MissingScheme</span> => <span class="prelude-val">None</span>,
|
||||
<span class="ident">ParseError::MissingField</span>(<span class="kw">_</span>) => <span class="prelude-val">None</span>,
|
||||
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</span>) => <span class="prelude-val">Some</span>(<span class="ident">e</span>),
|
||||
<span class="ident">ParseError::Base64DecodeError</span>(<span class="ident">e</span>) => <span class="prelude-val">Some</span>(<span class="ident">e</span>),
|
||||
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>) => <span class="prelude-val">Some</span>(<span class="ident">e</span>),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">From</span><span class="op"><</span><span class="ident">header::ToStrError</span><span class="op">></span> <span class="kw">for</span> <span class="ident">ParseError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">header::ToStrError</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">header::ToStrError</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">ParseError::ToStrError</span>(<span class="ident">e</span>)
|
||||
}
|
||||
}
|
||||
<span class="kw">impl</span> <span class="ident">From</span><span class="op"><</span><span class="ident">base64::DecodeError</span><span class="op">></span> <span class="kw">for</span> <span class="ident">ParseError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">base64::DecodeError</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">base64::DecodeError</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">ParseError::Base64DecodeError</span>(<span class="ident">e</span>)
|
||||
}
|
||||
}
|
||||
<span class="kw">impl</span> <span class="ident">From</span><span class="op"><</span><span class="ident">str::Utf8Error</span><span class="op">></span> <span class="kw">for</span> <span class="ident">ParseError</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">str::Utf8Error</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">e</span>: <span class="ident">str::Utf8Error</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">ParseError::Utf8Error</span>(<span class="ident">e</span>)
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@
|
||||
<span class="doccomment">/// implementation.</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// [`Scheme`]: ./trait.Scheme.html</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">into_scheme</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">S</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">into_scheme</span>(<span class="self">self</span>) -> <span class="ident">S</span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>
|
||||
}
|
||||
}
|
||||
@ -150,7 +150,7 @@
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">S</span>: <span class="ident">Scheme</span>,
|
||||
{
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">scheme</span>: <span class="ident">S</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Authorization</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">from</span>(<span class="ident">scheme</span>: <span class="ident">S</span>) -> <span class="ident">Authorization</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> {
|
||||
<span class="ident">Authorization</span>(<span class="ident">scheme</span>)
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">S</span>: <span class="ident">Scheme</span>,
|
||||
{
|
||||
<span class="kw">fn</span> <span class="ident">as_ref</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="ident">S</span> {
|
||||
<span class="kw">fn</span> <span class="ident">as_ref</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw-2">&</span><span class="ident">S</span> {
|
||||
<span class="kw-2">&</span><span class="self">self</span>.<span class="number">0</span>
|
||||
}
|
||||
}
|
||||
@ -168,18 +168,18 @@
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">S</span>: <span class="ident">Scheme</span>,
|
||||
{
|
||||
<span class="kw">fn</span> <span class="ident">as_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">S</span> {
|
||||
<span class="kw">fn</span> <span class="ident">as_mut</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">S</span> {
|
||||
<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>.<span class="number">0</span>
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Scheme</span><span class="op">></span> <span class="ident">Header</span> <span class="kw">for</span> <span class="ident">Authorization</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> {
|
||||
<span class="attribute">#[<span class="ident">inline</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">name</span>() <span class="op">-</span><span class="op">></span> <span class="ident">HeaderName</span> {
|
||||
<span class="kw">fn</span> <span class="ident">name</span>() -> <span class="ident">HeaderName</span> {
|
||||
<span class="ident">AUTHORIZATION</span>
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">parse</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">HttpMessage</span><span class="op">></span>(<span class="ident">msg</span>: <span class="kw-2">&</span><span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">ParseError</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">HttpMessage</span><span class="op">></span>(<span class="ident">msg</span>: <span class="kw-2">&</span><span class="ident">T</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">ParseError</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">header</span> <span class="op">=</span> <span class="ident">msg</span>.<span class="ident">headers</span>().<span class="ident">get</span>(<span class="ident">AUTHORIZATION</span>).<span class="ident">ok_or</span>(<span class="ident">ParseError::Header</span>)<span class="question-mark">?</span>;
|
||||
<span class="kw">let</span> <span class="ident">scheme</span> <span class="op">=</span> <span class="ident">S::parse</span>(<span class="ident">header</span>).<span class="ident">map_err</span>(<span class="op">|</span><span class="kw">_</span><span class="op">|</span> <span class="ident">ParseError::Header</span>)<span class="question-mark">?</span>;
|
||||
|
||||
@ -190,13 +190,13 @@
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Scheme</span><span class="op">></span> <span class="ident">IntoHeaderValue</span> <span class="kw">for</span> <span class="ident">Authorization</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> {
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="op"><</span><span class="ident">S</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="ident"><span class="self">Self</span>::Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="ident"><span class="self">Self</span>::Error</span><span class="op">></span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>.<span class="ident">try_into_value</span>()
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">S</span>: <span class="ident">Scheme</span><span class="op">></span> <span class="ident">fmt::Display</span> <span class="kw">for</span> <span class="ident">Authorization</span><span class="op"><</span><span class="ident">S</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="ident">fmt::Display::fmt</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="number">0</span>, <span class="ident">f</span>)
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,7 @@
|
||||
<span class="doccomment">/// # use actix_web_httpauth::headers::authorization::Basic;</span>
|
||||
<span class="doccomment">/// let credentials = Basic::new("Alladin", Some("open sesame"));</span>
|
||||
<span class="doccomment">/// ```</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span><span class="op"><</span><span class="ident">U</span>, <span class="ident">P</span><span class="op">></span>(<span class="ident">user_id</span>: <span class="ident">U</span>, <span class="ident">password</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">P</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">Basic</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span><span class="op"><</span><span class="ident">U</span>, <span class="ident">P</span><span class="op">></span>(<span class="ident">user_id</span>: <span class="ident">U</span>, <span class="ident">password</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">P</span><span class="op">></span>) -> <span class="ident">Basic</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">U</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span>,
|
||||
<span class="ident">P</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span>,
|
||||
@ -234,18 +234,18 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Returns client's user-ID.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">user_id</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">user_id</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw-2">&</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span> {
|
||||
<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">user_id</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Returns client's password if provided.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">password</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">password</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="kw-2">&</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span> {
|
||||
<span class="self">self</span>.<span class="ident">password</span>.<span class="ident">as_ref</span>()
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Scheme</span> <span class="kw">for</span> <span class="ident">Basic</span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">header</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">ParseError</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">header</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">ParseError</span><span class="op">></span> {
|
||||
<span class="comment">// "Basic *" length</span>
|
||||
<span class="kw">if</span> <span class="ident">header</span>.<span class="ident">len</span>() <span class="op"><</span> <span class="number">7</span> {
|
||||
<span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">ParseError::Invalid</span>);
|
||||
@ -253,8 +253,8 @@
|
||||
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">parts</span> <span class="op">=</span> <span class="ident">header</span>.<span class="ident">to_str</span>()<span class="question-mark">?</span>.<span class="ident">splitn</span>(<span class="number">2</span>, <span class="string">' '</span>);
|
||||
<span class="kw">match</span> <span class="ident">parts</span>.<span class="ident">next</span>() {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">scheme</span>) <span class="kw">if</span> <span class="ident">scheme</span> <span class="op">=</span><span class="op">=</span> <span class="string">"Basic"</span> <span class="op">=</span><span class="op">></span> (),
|
||||
<span class="kw">_</span> <span class="op">=</span><span class="op">></span> <span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">ParseError::MissingScheme</span>),
|
||||
<span class="prelude-val">Some</span>(<span class="ident">scheme</span>) <span class="kw">if</span> <span class="ident">scheme</span> <span class="op">==</span> <span class="string">"Basic"</span> => (),
|
||||
<span class="kw">_</span> => <span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">ParseError::MissingScheme</span>),
|
||||
}
|
||||
|
||||
<span class="kw">let</span> <span class="ident">decoded</span> <span class="op">=</span> <span class="ident">base64::decode</span>(<span class="ident">parts</span>.<span class="ident">next</span>().<span class="ident">ok_or</span>(<span class="ident">ParseError::Invalid</span>)<span class="question-mark">?</span>)<span class="question-mark">?</span>;
|
||||
@ -280,13 +280,13 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">fmt::Debug</span> <span class="kw">for</span> <span class="ident">Basic</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="ident">f</span>.<span class="ident">write_fmt</span>(<span class="macro">format_args!</span>(<span class="string">"Basic {}:******"</span>, <span class="self">self</span>.<span class="ident">user_id</span>))
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">fmt::Display</span> <span class="kw">for</span> <span class="ident">Basic</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="ident">f</span>.<span class="ident">write_fmt</span>(<span class="macro">format_args!</span>(<span class="string">"Basic {}:******"</span>, <span class="self">self</span>.<span class="ident">user_id</span>))
|
||||
}
|
||||
}
|
||||
@ -294,7 +294,7 @@
|
||||
<span class="kw">impl</span> <span class="ident">IntoHeaderValue</span> <span class="kw">for</span> <span class="ident">Basic</span> {
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">InvalidHeaderValue</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">credentials</span> <span class="op">=</span> <span class="ident">BytesMut::with_capacity</span>(
|
||||
<span class="self">self</span>.<span class="ident">user_id</span>.<span class="ident">len</span>()
|
||||
<span class="op">+</span> <span class="number">1</span> <span class="comment">// ':'</span>
|
||||
|
@ -163,7 +163,7 @@
|
||||
<span class="doccomment">/// # use actix_web_httpauth::headers::authorization::Bearer;</span>
|
||||
<span class="doccomment">/// let credentials = Bearer::new("mF_9.B5f-4.1JqM");</span>
|
||||
<span class="doccomment">/// ```</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="ident">token</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Bearer</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="ident">token</span>: <span class="ident">T</span>) -> <span class="ident">Bearer</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
@ -173,13 +173,13 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Gets reference to the credentials token.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">token</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">token</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw-2">&</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span> {
|
||||
<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">token</span>
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Scheme</span> <span class="kw">for</span> <span class="ident">Bearer</span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">header</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">ParseError</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">header</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">ParseError</span><span class="op">></span> {
|
||||
<span class="comment">// "Bearer *" length</span>
|
||||
<span class="kw">if</span> <span class="ident">header</span>.<span class="ident">len</span>() <span class="op"><</span> <span class="number">8</span> {
|
||||
<span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">ParseError::Invalid</span>);
|
||||
@ -187,8 +187,8 @@
|
||||
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">parts</span> <span class="op">=</span> <span class="ident">header</span>.<span class="ident">to_str</span>()<span class="question-mark">?</span>.<span class="ident">splitn</span>(<span class="number">2</span>, <span class="string">' '</span>);
|
||||
<span class="kw">match</span> <span class="ident">parts</span>.<span class="ident">next</span>() {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">scheme</span>) <span class="kw">if</span> <span class="ident">scheme</span> <span class="op">=</span><span class="op">=</span> <span class="string">"Bearer"</span> <span class="op">=</span><span class="op">></span> (),
|
||||
<span class="kw">_</span> <span class="op">=</span><span class="op">></span> <span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">ParseError::MissingScheme</span>),
|
||||
<span class="prelude-val">Some</span>(<span class="ident">scheme</span>) <span class="kw">if</span> <span class="ident">scheme</span> <span class="op">==</span> <span class="string">"Bearer"</span> => (),
|
||||
<span class="kw">_</span> => <span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">ParseError::MissingScheme</span>),
|
||||
}
|
||||
|
||||
<span class="kw">let</span> <span class="ident">token</span> <span class="op">=</span> <span class="ident">parts</span>.<span class="ident">next</span>().<span class="ident">ok_or</span>(<span class="ident">ParseError::Invalid</span>)<span class="question-mark">?</span>;
|
||||
@ -200,13 +200,13 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">fmt::Debug</span> <span class="kw">for</span> <span class="ident">Bearer</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="ident">f</span>.<span class="ident">write_fmt</span>(<span class="macro">format_args!</span>(<span class="string">"Bearer ******"</span>))
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">fmt::Display</span> <span class="kw">for</span> <span class="ident">Bearer</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="ident">f</span>.<span class="ident">write_fmt</span>(<span class="macro">format_args!</span>(<span class="string">"Bearer {}"</span>, <span class="self">self</span>.<span class="ident">token</span>))
|
||||
}
|
||||
}
|
||||
@ -214,7 +214,7 @@
|
||||
<span class="kw">impl</span> <span class="ident">IntoHeaderValue</span> <span class="kw">for</span> <span class="ident">Bearer</span> {
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">InvalidHeaderValue</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buffer</span> <span class="op">=</span> <span class="ident">BytesMut::with_capacity</span>(<span class="number">7</span> <span class="op">+</span> <span class="self">self</span>.<span class="ident">token</span>.<span class="ident">len</span>());
|
||||
<span class="ident">buffer</span>.<span class="ident">put</span>(<span class="kw-2">&</span><span class="string">b"Bearer "</span>[..]);
|
||||
<span class="ident">buffer</span>.<span class="ident">extend_from_slice</span>(<span class="self">self</span>.<span class="ident">token</span>.<span class="ident">as_bytes</span>());
|
||||
|
@ -26,7 +26,7 @@
|
||||
<span class="doccomment">/// header.</span>
|
||||
<span class="kw">pub</span> <span class="kw">trait</span> <span class="ident">Scheme</span>: <span class="ident">IntoHeaderValue</span> <span class="op">+</span> <span class="ident">Debug</span> <span class="op">+</span> <span class="ident">Display</span> <span class="op">+</span> <span class="ident">Clone</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Sync</span> {
|
||||
<span class="doccomment">/// Try to parse the authentication scheme from the `Authorization` header.</span>
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">header</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">ParseError</span><span class="op">></span>;
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">header</span>: <span class="kw-2">&</span><span class="ident">HeaderValue</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">ParseError</span><span class="op">></span>;
|
||||
}
|
||||
</code></pre></div>
|
||||
</section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../../../search-index.js" data-search-js="../../../../../search.js"></div>
|
||||
|
@ -186,7 +186,7 @@
|
||||
<span class="doccomment">/// # use actix_web_httpauth::headers::www_authenticate::basic::Basic;</span>
|
||||
<span class="doccomment">/// let challenge = Basic::new();</span>
|
||||
<span class="doccomment">/// ```</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>() <span class="op">-</span><span class="op">></span> <span class="ident">Basic</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>() -> <span class="ident">Basic</span> {
|
||||
<span class="ident">Default::default</span>()
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@
|
||||
<span class="doccomment">/// let my_realm = "Earth realm".to_string();</span>
|
||||
<span class="doccomment">/// let challenge = Basic::with_realm(my_realm);</span>
|
||||
<span class="doccomment">/// ```</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">with_realm</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="ident">value</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Basic</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">with_realm</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="ident">value</span>: <span class="ident">T</span>) -> <span class="ident">Basic</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
@ -216,7 +216,7 @@
|
||||
|
||||
<span class="attribute">#[<span class="ident">doc</span>(<span class="ident">hidden</span>)]</span>
|
||||
<span class="kw">impl</span> <span class="ident">Challenge</span> <span class="kw">for</span> <span class="ident">Basic</span> {
|
||||
<span class="kw">fn</span> <span class="ident">to_bytes</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Bytes</span> {
|
||||
<span class="kw">fn</span> <span class="ident">to_bytes</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">Bytes</span> {
|
||||
<span class="comment">// 5 is for `"Basic"`, 9 is for `"realm=\"\""`</span>
|
||||
<span class="kw">let</span> <span class="ident">length</span> <span class="op">=</span> <span class="number">5</span> <span class="op">+</span> <span class="self">self</span>.<span class="ident">realm</span>.<span class="ident">as_ref</span>().<span class="ident">map_or</span>(<span class="number">0</span>, <span class="op">|</span><span class="ident">realm</span><span class="op">|</span> <span class="ident">realm</span>.<span class="ident">len</span>() <span class="op">+</span> <span class="number">9</span>);
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">buffer</span> <span class="op">=</span> <span class="ident">BytesMut::with_capacity</span>(<span class="ident">length</span>);
|
||||
@ -232,7 +232,7 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">fmt::Display</span> <span class="kw">for</span> <span class="ident">Basic</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">fmt::Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">fmt::Error</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">bytes</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">to_bytes</span>();
|
||||
<span class="kw">let</span> <span class="ident">repr</span> <span class="op">=</span> <span class="ident">str::from_utf8</span>(<span class="kw-2">&</span><span class="ident">bytes</span>)
|
||||
<span class="comment">// Should not happen since challenges are crafted manually</span>
|
||||
@ -246,7 +246,7 @@
|
||||
<span class="kw">impl</span> <span class="ident">IntoHeaderValue</span> <span class="kw">for</span> <span class="ident">Basic</span> {
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">InvalidHeaderValue</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span><span class="op">></span> {
|
||||
<span class="ident">HeaderValue::from_maybe_shared</span>(<span class="self">self</span>.<span class="ident">to_bytes</span>())
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">BearerBuilder</span> {
|
||||
<span class="doccomment">/// Provides the `scope` attribute, as defined in [RFC6749, Section 3.3](https://tools.ietf.org/html/rfc6749#section-3.3)</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">scope</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">scope</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) -> <span class="self">Self</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
@ -85,7 +85,7 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Provides the `realm` attribute, as defined in [RFC2617](https://tools.ietf.org/html/rfc2617)</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">realm</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">realm</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) -> <span class="self">Self</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
@ -94,13 +94,13 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Provides the `error` attribute, as defined in [RFC6750, Section 3.1](https://tools.ietf.org/html/rfc6750#section-3.1)</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">error</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">Error</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">error</span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">Error</span>) -> <span class="self">Self</span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>.<span class="ident">error</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">value</span>);
|
||||
<span class="self">self</span>
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Provides the `error_description` attribute, as defined in [RFC6750, Section 3](https://tools.ietf.org/html/rfc6750#section-3)</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">error_description</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">error_description</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) -> <span class="self">Self</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
@ -111,7 +111,7 @@
|
||||
<span class="doccomment">/// Provides the `error_uri` attribute, as defined in [RFC6750, Section 3](https://tools.ietf.org/html/rfc6750#section-3)</span>
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// It is up to implementor to provide properly-formed absolute URI.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">error_uri</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">error_uri</span><span class="op"><</span><span class="ident">T</span><span class="op">></span>(<span class="kw-2">mut</span> <span class="self">self</span>, <span class="ident">value</span>: <span class="ident">T</span>) -> <span class="self">Self</span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">Into</span><span class="op"><</span><span class="ident">Cow</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="ident">str</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
@ -120,7 +120,7 @@
|
||||
}
|
||||
|
||||
<span class="doccomment">/// Consumes the builder and returns built `Bearer` instance.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">finish</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Bearer</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">finish</span>(<span class="self">self</span>) -> <span class="ident">Bearer</span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>
|
||||
}
|
||||
}
|
||||
|
@ -197,14 +197,14 @@
|
||||
<span class="doccomment">/// .scope("openid profile email")</span>
|
||||
<span class="doccomment">/// .finish();</span>
|
||||
<span class="doccomment">/// ```</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">build</span>() <span class="op">-</span><span class="op">></span> <span class="ident">BearerBuilder</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">build</span>() -> <span class="ident">BearerBuilder</span> {
|
||||
<span class="ident">BearerBuilder::default</span>()
|
||||
}
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">doc</span>(<span class="ident">hidden</span>)]</span>
|
||||
<span class="kw">impl</span> <span class="ident">Challenge</span> <span class="kw">for</span> <span class="ident">Bearer</span> {
|
||||
<span class="kw">fn</span> <span class="ident">to_bytes</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Bytes</span> {
|
||||
<span class="kw">fn</span> <span class="ident">to_bytes</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">Bytes</span> {
|
||||
<span class="kw">let</span> <span class="ident">desc_uri_required</span> <span class="op">=</span> <span class="self">self</span>
|
||||
.<span class="ident">error_description</span>
|
||||
.<span class="ident">as_ref</span>()
|
||||
@ -258,7 +258,7 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">fmt::Display</span> <span class="kw">for</span> <span class="ident">Bearer</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">fmt::Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="prelude-ty">Result</span><span class="op"><</span>(), <span class="ident">fmt::Error</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">bytes</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">to_bytes</span>();
|
||||
<span class="kw">let</span> <span class="ident">repr</span> <span class="op">=</span> <span class="ident">str::from_utf8</span>(<span class="kw-2">&</span><span class="ident">bytes</span>)
|
||||
<span class="comment">// Should not happen since challenges are crafted manually</span>
|
||||
@ -272,7 +272,7 @@
|
||||
<span class="kw">impl</span> <span class="ident">IntoHeaderValue</span> <span class="kw">for</span> <span class="ident">Bearer</span> {
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="ident">InvalidHeaderValue</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span><span class="op">></span> {
|
||||
<span class="ident">HeaderValue::from_maybe_shared</span>(<span class="self">self</span>.<span class="ident">to_bytes</span>())
|
||||
}
|
||||
}
|
||||
|
@ -76,27 +76,27 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// [HTTP status code]: `actix_web::http::StatusCode`</span>
|
||||
<span class="attribute">#[<span class="ident">allow</span>(<span class="ident">clippy::trivially_copy_pass_by_ref</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">status_code</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">StatusCode</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">status_code</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">StatusCode</span> {
|
||||
<span class="kw">match</span> <span class="self">self</span> {
|
||||
<span class="ident">Error::InvalidRequest</span> <span class="op">=</span><span class="op">></span> <span class="ident">StatusCode::BAD_REQUEST</span>,
|
||||
<span class="ident">Error::InvalidToken</span> <span class="op">=</span><span class="op">></span> <span class="ident">StatusCode::UNAUTHORIZED</span>,
|
||||
<span class="ident">Error::InsufficientScope</span> <span class="op">=</span><span class="op">></span> <span class="ident">StatusCode::FORBIDDEN</span>,
|
||||
<span class="ident">Error::InvalidRequest</span> => <span class="ident">StatusCode::BAD_REQUEST</span>,
|
||||
<span class="ident">Error::InvalidToken</span> => <span class="ident">StatusCode::UNAUTHORIZED</span>,
|
||||
<span class="ident">Error::InsufficientScope</span> => <span class="ident">StatusCode::FORBIDDEN</span>,
|
||||
}
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">doc</span>(<span class="ident">hidden</span>)]</span>
|
||||
<span class="attribute">#[<span class="ident">allow</span>(<span class="ident">clippy::trivially_copy_pass_by_ref</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">as_str</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="kw-2">&</span><span class="ident">str</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">as_str</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="kw-2">&</span><span class="ident">str</span> {
|
||||
<span class="kw">match</span> <span class="self">self</span> {
|
||||
<span class="ident">Error::InvalidRequest</span> <span class="op">=</span><span class="op">></span> <span class="string">"invalid_request"</span>,
|
||||
<span class="ident">Error::InvalidToken</span> <span class="op">=</span><span class="op">></span> <span class="string">"invalid_token"</span>,
|
||||
<span class="ident">Error::InsufficientScope</span> <span class="op">=</span><span class="op">></span> <span class="string">"insufficient_scope"</span>,
|
||||
<span class="ident">Error::InvalidRequest</span> => <span class="string">"invalid_request"</span>,
|
||||
<span class="ident">Error::InvalidToken</span> => <span class="string">"invalid_token"</span>,
|
||||
<span class="ident">Error::InsufficientScope</span> => <span class="string">"insufficient_scope"</span>,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">fmt::Display</span> <span class="kw">for</span> <span class="ident">Error</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">fn</span> <span class="ident">fmt</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">f</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">fmt::Formatter</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="ident">f</span>.<span class="ident">write_str</span>(<span class="self">self</span>.<span class="ident">as_str</span>())
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
<span class="doccomment">/// Authentication challenge for `WWW-Authenticate` header.</span>
|
||||
<span class="kw">pub</span> <span class="kw">trait</span> <span class="ident">Challenge</span>: <span class="ident">IntoHeaderValue</span> <span class="op">+</span> <span class="ident">Debug</span> <span class="op">+</span> <span class="ident">Display</span> <span class="op">+</span> <span class="ident">Clone</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Sync</span> {
|
||||
<span class="doccomment">/// Converts the challenge into a bytes suitable for HTTP transmission.</span>
|
||||
<span class="kw">fn</span> <span class="ident">to_bytes</span>(<span class="kw-2">&</span><span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Bytes</span>;
|
||||
<span class="kw">fn</span> <span class="ident">to_bytes</span>(<span class="kw-2">&</span><span class="self">self</span>) -> <span class="ident">Bytes</span>;
|
||||
}
|
||||
</code></pre></div>
|
||||
</section><section id="search" class="content hidden"></section><div id="rustdoc-vars" data-root-path="../../../../../" data-current-crate="actix_web_httpauth" data-search-index-js="../../../../../search-index.js" data-search-js="../../../../../search.js"></div>
|
||||
|
@ -44,11 +44,11 @@
|
||||
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">WwwAuthenticate</span><span class="op"><</span><span class="ident">C</span>: <span class="ident">Challenge</span><span class="op">></span>(<span class="kw">pub</span> <span class="ident">C</span>);
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">C</span>: <span class="ident">Challenge</span><span class="op">></span> <span class="ident">Header</span> <span class="kw">for</span> <span class="ident">WwwAuthenticate</span><span class="op"><</span><span class="ident">C</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">name</span>() <span class="op">-</span><span class="op">></span> <span class="ident">HeaderName</span> {
|
||||
<span class="kw">fn</span> <span class="ident">name</span>() -> <span class="ident">HeaderName</span> {
|
||||
<span class="ident">WWW_AUTHENTICATE</span>
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">parse</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">HttpMessage</span><span class="op">></span>(<span class="ident">_msg</span>: <span class="kw-2">&</span><span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">ParseError</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span><span class="op"><</span><span class="ident">T</span>: <span class="ident">HttpMessage</span><span class="op">></span>(<span class="ident">_msg</span>: <span class="kw-2">&</span><span class="ident">T</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">ParseError</span><span class="op">></span> {
|
||||
<span class="macro">unimplemented!</span>()
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,7 @@
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">C</span>: <span class="ident">Challenge</span><span class="op">></span> <span class="ident">IntoHeaderValue</span> <span class="kw">for</span> <span class="ident">WwwAuthenticate</span><span class="op"><</span><span class="ident">C</span><span class="op">></span> {
|
||||
<span class="kw">type</span> <span class="ident">Error</span> <span class="op">=</span> <span class="op"><</span><span class="ident">C</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">try_into_value</span>(<span class="self">self</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">HeaderValue</span>, <span class="op"><</span><span class="self">Self</span> <span class="kw">as</span> <span class="ident">IntoHeaderValue</span><span class="op">></span><span class="ident">::Error</span><span class="op">></span> {
|
||||
<span class="self">self</span>.<span class="number">0</span>.<span class="ident">try_into_value</span>()
|
||||
}
|
||||
}
|
||||
|
@ -348,12 +348,12 @@
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span>, <span class="ident">F</span>, <span class="ident">O</span><span class="op">></span> <span class="ident">HttpAuthentication</span><span class="op"><</span><span class="ident">T</span>, <span class="ident">F</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">T</span>: <span class="ident">AuthExtractor</span>,
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">ServiceRequest</span>, <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="ident">O</span>,
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">ServiceRequest</span>, <span class="ident">T</span>) -> <span class="ident">O</span>,
|
||||
<span class="ident">O</span>: <span class="ident">Future</span><span class="op"><</span><span class="ident">Output</span> <span class="op">=</span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">ServiceRequest</span>, <span class="ident">Error</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
<span class="doccomment">/// Construct `HttpAuthentication` middleware with the provided auth extractor `T` and</span>
|
||||
<span class="doccomment">/// validation callback `F`.</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">with_fn</span>(<span class="ident">process_fn</span>: <span class="ident">F</span>) <span class="op">-</span><span class="op">></span> <span class="ident">HttpAuthentication</span><span class="op"><</span><span class="ident">T</span>, <span class="ident">F</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">with_fn</span>(<span class="ident">process_fn</span>: <span class="ident">F</span>) -> <span class="ident">HttpAuthentication</span><span class="op"><</span><span class="ident">T</span>, <span class="ident">F</span><span class="op">></span> {
|
||||
<span class="ident">HttpAuthentication</span> {
|
||||
<span class="ident">process_fn</span>: <span class="ident">Arc::new</span>(<span class="ident">process_fn</span>),
|
||||
<span class="ident">_extractor</span>: <span class="ident">PhantomData</span>,
|
||||
@ -363,7 +363,7 @@
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">F</span>, <span class="ident">O</span><span class="op">></span> <span class="ident">HttpAuthentication</span><span class="op"><</span><span class="ident">basic::BasicAuth</span>, <span class="ident">F</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">ServiceRequest</span>, <span class="ident">basic::BasicAuth</span>) <span class="op">-</span><span class="op">></span> <span class="ident">O</span>,
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">ServiceRequest</span>, <span class="ident">basic::BasicAuth</span>) -> <span class="ident">O</span>,
|
||||
<span class="ident">O</span>: <span class="ident">Future</span><span class="op"><</span><span class="ident">Output</span> <span class="op">=</span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">ServiceRequest</span>, <span class="ident">Error</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
<span class="doccomment">/// Construct `HttpAuthentication` middleware for the HTTP "Basic" authentication scheme.</span>
|
||||
@ -388,14 +388,14 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// let middleware = HttpAuthentication::basic(validator);</span>
|
||||
<span class="doccomment">/// ```</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">basic</span>(<span class="ident">process_fn</span>: <span class="ident">F</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">basic</span>(<span class="ident">process_fn</span>: <span class="ident">F</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident"><span class="self">Self</span>::with_fn</span>(<span class="ident">process_fn</span>)
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">F</span>, <span class="ident">O</span><span class="op">></span> <span class="ident">HttpAuthentication</span><span class="op"><</span><span class="ident">bearer::BearerAuth</span>, <span class="ident">F</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">ServiceRequest</span>, <span class="ident">bearer::BearerAuth</span>) <span class="op">-</span><span class="op">></span> <span class="ident">O</span>,
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">ServiceRequest</span>, <span class="ident">bearer::BearerAuth</span>) -> <span class="ident">O</span>,
|
||||
<span class="ident">O</span>: <span class="ident">Future</span><span class="op"><</span><span class="ident">Output</span> <span class="op">=</span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">ServiceRequest</span>, <span class="ident">Error</span><span class="op">></span><span class="op">></span>,
|
||||
{
|
||||
<span class="doccomment">/// Construct `HttpAuthentication` middleware for the HTTP "Bearer" authentication scheme.</span>
|
||||
@ -423,7 +423,7 @@
|
||||
<span class="doccomment">///</span>
|
||||
<span class="doccomment">/// let middleware = HttpAuthentication::bearer(validator);</span>
|
||||
<span class="doccomment">/// ```</span>
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">bearer</span>(<span class="ident">process_fn</span>: <span class="ident">F</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">bearer</span>(<span class="ident">process_fn</span>: <span class="ident">F</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident"><span class="self">Self</span>::with_fn</span>(<span class="ident">process_fn</span>)
|
||||
}
|
||||
}
|
||||
@ -432,7 +432,7 @@
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">S</span>: <span class="ident">Service</span><span class="op"><</span><span class="ident">ServiceRequest</span>, <span class="ident">Response</span> <span class="op">=</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>, <span class="ident">Error</span> <span class="op">=</span> <span class="ident">Error</span><span class="op">></span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">S::Future</span>: <span class="lifetime">'static</span>,
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">ServiceRequest</span>, <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="ident">O</span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">ServiceRequest</span>, <span class="ident">T</span>) -> <span class="ident">O</span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">O</span>: <span class="ident">Future</span><span class="op"><</span><span class="ident">Output</span> <span class="op">=</span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">ServiceRequest</span>, <span class="ident">Error</span><span class="op">></span><span class="op">></span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">T</span>: <span class="ident">AuthExtractor</span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">B</span>: <span class="ident">MessageBody</span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
@ -444,7 +444,7 @@
|
||||
<span class="kw">type</span> <span class="ident">InitError</span> <span class="op">=</span> ();
|
||||
<span class="kw">type</span> <span class="ident">Future</span> <span class="op">=</span> <span class="ident">future::Ready</span><span class="op"><</span><span class="prelude-ty">Result</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Transform</span>, <span class="ident"><span class="self">Self</span>::InitError</span><span class="op">></span><span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">new_transform</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">service</span>: <span class="ident">S</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">new_transform</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">service</span>: <span class="ident">S</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="ident">future::ok</span>(<span class="ident">AuthenticationMiddleware</span> {
|
||||
<span class="ident">service</span>: <span class="ident">Rc::new</span>(<span class="ident">service</span>),
|
||||
<span class="ident">process_fn</span>: <span class="self">self</span>.<span class="ident">process_fn</span>.<span class="ident">clone</span>(),
|
||||
@ -467,7 +467,7 @@
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">S</span>: <span class="ident">Service</span><span class="op"><</span><span class="ident">ServiceRequest</span>, <span class="ident">Response</span> <span class="op">=</span> <span class="ident">ServiceResponse</span><span class="op"><</span><span class="ident">B</span><span class="op">></span>, <span class="ident">Error</span> <span class="op">=</span> <span class="ident">Error</span><span class="op">></span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">S::Future</span>: <span class="lifetime">'static</span>,
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">ServiceRequest</span>, <span class="ident">T</span>) <span class="op">-</span><span class="op">></span> <span class="ident">O</span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">F</span>: <span class="ident">Fn</span>(<span class="ident">ServiceRequest</span>, <span class="ident">T</span>) -> <span class="ident">O</span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">O</span>: <span class="ident">Future</span><span class="op"><</span><span class="ident">Output</span> <span class="op">=</span> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">ServiceRequest</span>, <span class="ident">Error</span><span class="op">></span><span class="op">></span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">T</span>: <span class="ident">AuthExtractor</span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
<span class="ident">B</span>: <span class="ident">MessageBody</span> <span class="op">+</span> <span class="lifetime">'static</span>,
|
||||
@ -479,15 +479,15 @@
|
||||
|
||||
<span class="macro">actix_service::forward_ready!</span>(<span class="ident">service</span>);
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">fn</span> <span class="ident">call</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">req</span>: <span class="ident">ServiceRequest</span>) -> <span class="ident"><span class="self">Self</span>::Future</span> {
|
||||
<span class="kw">let</span> <span class="ident">process_fn</span> <span class="op">=</span> <span class="ident">Arc::clone</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">process_fn</span>);
|
||||
|
||||
<span class="kw">let</span> <span class="ident">service</span> <span class="op">=</span> <span class="ident">Rc::clone</span>(<span class="kw-2">&</span><span class="self">self</span>.<span class="ident">service</span>);
|
||||
|
||||
<span class="kw">async</span> <span class="kw">move</span> {
|
||||
<span class="kw">let</span> (<span class="ident">req</span>, <span class="ident">credentials</span>) <span class="op">=</span> <span class="kw">match</span> <span class="ident">Extract</span>::<span class="op"><</span><span class="ident">T</span><span class="op">></span><span class="ident">::new</span>(<span class="ident">req</span>).<span class="kw">await</span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">req</span>) <span class="op">=</span><span class="op">></span> <span class="ident">req</span>,
|
||||
<span class="prelude-val">Err</span>((<span class="ident">err</span>, <span class="ident">req</span>)) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">req</span>) => <span class="ident">req</span>,
|
||||
<span class="prelude-val">Err</span>((<span class="ident">err</span>, <span class="ident">req</span>)) => {
|
||||
<span class="kw">return</span> <span class="prelude-val">Ok</span>(<span class="ident">req</span>.<span class="ident">error_response</span>(<span class="ident">err</span>));
|
||||
}
|
||||
};
|
||||
@ -508,11 +508,11 @@
|
||||
<span class="kw">struct</span> <span class="ident">Extract</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="ident">req</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">ServiceRequest</span><span class="op">></span>,
|
||||
<span class="ident">f</span>: <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">LocalBoxFuture</span><span class="op"><</span><span class="lifetime">'static</span>, <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident">T</span>, <span class="ident">Error</span><span class="op">></span><span class="op">></span><span class="op">></span>,
|
||||
<span class="ident">_extractor</span>: <span class="ident">PhantomData</span><span class="op"><</span><span class="kw">fn</span>() <span class="op">-</span><span class="op">></span> <span class="ident">T</span><span class="op">></span>,
|
||||
<span class="ident">_extractor</span>: <span class="ident">PhantomData</span><span class="op"><</span><span class="kw">fn</span>() -> <span class="ident">T</span><span class="op">></span>,
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> <span class="ident">Extract</span><span class="op"><</span><span class="ident">T</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">req</span>: <span class="ident">ServiceRequest</span>) <span class="op">-</span><span class="op">></span> <span class="self">Self</span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">req</span>: <span class="ident">ServiceRequest</span>) -> <span class="self">Self</span> {
|
||||
<span class="ident">Extract</span> {
|
||||
<span class="ident">req</span>: <span class="prelude-val">Some</span>(<span class="ident">req</span>),
|
||||
<span class="ident">f</span>: <span class="prelude-val">None</span>,
|
||||
@ -529,7 +529,7 @@
|
||||
{
|
||||
<span class="kw">type</span> <span class="ident">Output</span> <span class="op">=</span> <span class="prelude-ty">Result</span><span class="op"><</span>(<span class="ident">ServiceRequest</span>, <span class="ident">T</span>), (<span class="ident">Error</span>, <span class="ident">ServiceRequest</span>)<span class="op">></span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">poll</span>(<span class="kw-2">mut</span> <span class="self">self</span>: <span class="ident">Pin</span><span class="op"><</span><span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">Self</span><span class="op">></span>, <span class="ident">ctx</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Context</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) <span class="op">-</span><span class="op">></span> <span class="ident">Poll</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Output</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">poll</span>(<span class="kw-2">mut</span> <span class="self">self</span>: <span class="ident">Pin</span><span class="op"><</span><span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">Self</span><span class="op">></span>, <span class="ident">ctx</span>: <span class="kw-2">&</span><span class="kw-2">mut</span> <span class="ident">Context</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span>) -> <span class="ident">Poll</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Output</span><span class="op">></span> {
|
||||
<span class="kw">if</span> <span class="self">self</span>.<span class="ident">f</span>.<span class="ident">is_none</span>() {
|
||||
<span class="kw">let</span> <span class="ident">req</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">req</span>.<span class="ident">as_ref</span>().<span class="ident">expect</span>(<span class="string">"Extract future was polled twice!"</span>);
|
||||
<span class="kw">let</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">T::from_service_request</span>(<span class="ident">req</span>).<span class="ident">map_err</span>(<span class="ident">Into::into</span>);
|
||||
|
@ -124,7 +124,7 @@
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span> <span class="ident">Quoted</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">s</span>: <span class="kw-2">&</span><span class="lifetime">'a</span> <span class="ident">str</span>) <span class="op">-</span><span class="op">></span> <span class="ident">Quoted</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">new</span>(<span class="ident">s</span>: <span class="kw-2">&</span><span class="lifetime">'a</span> <span class="ident">str</span>) -> <span class="ident">Quoted</span><span class="op"><</span><span class="lifetime">'_</span><span class="op">></span> {
|
||||
<span class="ident">Quoted</span> {
|
||||
<span class="ident">inner</span>: <span class="ident">s</span>.<span class="ident">split</span>(<span class="string">'"'</span>).<span class="ident">peekable</span>(),
|
||||
<span class="ident">state</span>: <span class="ident">State::YieldStr</span>,
|
||||
@ -135,21 +135,21 @@
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span> <span class="ident">Iterator</span> <span class="kw">for</span> <span class="ident">Quoted</span><span class="op"><</span><span class="lifetime">'a</span><span class="op">></span> {
|
||||
<span class="kw">type</span> <span class="ident">Item</span> <span class="op">=</span> <span class="kw-2">&</span><span class="lifetime">'a</span> <span class="ident">str</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">next</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) <span class="op">-</span><span class="op">></span> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Item</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">next</span>(<span class="kw-2">&</span><span class="kw-2">mut</span> <span class="self">self</span>) -> <span class="prelude-ty">Option</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Item</span><span class="op">></span> {
|
||||
<span class="kw">match</span> <span class="self">self</span>.<span class="ident">state</span> {
|
||||
<span class="ident">State::YieldStr</span> <span class="op">=</span><span class="op">></span> <span class="kw">match</span> <span class="self">self</span>.<span class="ident">inner</span>.<span class="ident">next</span>() {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">s</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">State::YieldStr</span> => <span class="kw">match</span> <span class="self">self</span>.<span class="ident">inner</span>.<span class="ident">next</span>() {
|
||||
<span class="prelude-val">Some</span>(<span class="ident">s</span>) => {
|
||||
<span class="self">self</span>.<span class="ident">state</span> <span class="op">=</span> <span class="ident">State::YieldQuote</span>;
|
||||
<span class="prelude-val">Some</span>(<span class="ident">s</span>)
|
||||
}
|
||||
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">None</span>,
|
||||
<span class="prelude-val">None</span> => <span class="prelude-val">None</span>,
|
||||
},
|
||||
<span class="ident">State::YieldQuote</span> <span class="op">=</span><span class="op">></span> <span class="kw">match</span> <span class="self">self</span>.<span class="ident">inner</span>.<span class="ident">peek</span>() {
|
||||
<span class="prelude-val">Some</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">></span> {
|
||||
<span class="ident">State::YieldQuote</span> => <span class="kw">match</span> <span class="self">self</span>.<span class="ident">inner</span>.<span class="ident">peek</span>() {
|
||||
<span class="prelude-val">Some</span>(<span class="kw">_</span>) => {
|
||||
<span class="self">self</span>.<span class="ident">state</span> <span class="op">=</span> <span class="ident">State::YieldStr</span>;
|
||||
<span class="prelude-val">Some</span>(<span class="string">"\\\""</span>)
|
||||
}
|
||||
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">></span> <span class="prelude-val">None</span>,
|
||||
<span class="prelude-val">None</span> => <span class="prelude-val">None</span>,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user