1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-08-30 11:08:08 +02:00

Deploying to gh-pages from @ 20ef05c36e 🚀

This commit is contained in:
robjtede
2021-06-27 06:05:12 +00:00
parent 55e0870178
commit 9a1bc876cc
172 changed files with 2077 additions and 2205 deletions

View File

@@ -1,7 +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="Source of the Rust file `actix-identity/src/cookie.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>cookie.rs - source</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="icon" type="image/svg+xml" href="../../favicon.svg">
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc source"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">&#9776;</div><a href='../../actix_identity/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" height="18" alt="Pick another theme!"></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" class="help-button">?</button>
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" height="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><pre class="line-numbers"><span id="1"> 1</span>
<!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="Source of the Rust file `actix-identity&#x2F;src&#x2F;cookie.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>cookie.rs - source</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="icon" type="image/svg+xml" href="../../favicon.svg"><link rel="alternate icon" type="image/png" href="../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc source"><!--[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">&#9776;</div><a href='../../actix_identity/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a></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"><div class="example-wrap"><pre class="line-numbers"><span id="1"> 1</span>
<span id="2"> 2</span>
<span id="3"> 3</span>
<span id="4"> 4</span>
@@ -828,7 +825,10 @@
<span id="825">825</span>
<span id="826">826</span>
<span id="827">827</span>
</pre><div class="example-wrap"><pre class="rust ">
<span id="828">828</span>
<span id="829">829</span>
<span id="830">830</span>
</pre><pre class="rust">
<span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">rc::Rc</span>, <span class="ident">time::SystemTime</span>};
<span class="kw">use</span> <span class="ident">futures_util::future</span>::{<span class="ident">ready</span>, <span class="ident">Ready</span>};
@@ -900,16 +900,17 @@
<span class="ident">value</span>: <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">CookieValue</span><span class="op">&gt;</span>,
) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>()<span class="op">&gt;</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> {
<span class="kw">if</span> <span class="op">!</span><span class="self">self</span>.<span class="ident">legacy_supported</span>() {
<span class="ident">serde_json::to_string</span>(<span class="kw-2">&amp;</span><span class="ident">val</span>)
} <span class="kw">else</span> {
<span class="prelude-val">Ok</span>(<span class="ident">val</span>.<span class="ident">identity</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> {
<span class="kw">if</span> <span class="op">!</span><span class="self">self</span>.<span class="ident">legacy_supported</span>() {
<span class="ident">serde_json::to_string</span>(<span class="kw-2">&amp;</span><span class="ident">val</span>)
} <span class="kw">else</span> {
<span class="prelude-val">Ok</span>(<span class="ident">val</span>.<span class="ident">identity</span>)
}
})
.<span class="ident">transpose</span>()<span class="question-mark">?</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::new</span>(<span class="self">self</span>.<span class="ident">name</span>.<span class="ident">clone</span>(), <span class="ident">val</span>.<span class="ident">unwrap_or_else</span>(<span class="op">|</span><span class="op">|</span> <span class="prelude-val">Ok</span>(<span class="ident">String::new</span>()))<span class="question-mark">?</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::new</span>(<span class="self">self</span>.<span class="ident">name</span>.<span class="ident">clone</span>(), <span class="ident">val</span>.<span class="ident">unwrap_or_default</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_secure</span>(<span class="self">self</span>.<span class="ident">secure</span>);
<span class="ident">cookie</span>.<span class="ident">set_http_only</span>(<span class="bool-val">true</span>);
@@ -939,10 +940,10 @@
};
<span class="kw">if</span> <span class="ident">add_cookie</span> {
<span class="ident">jar</span>.<span class="ident">private</span>(<span class="kw-2">&amp;</span><span class="ident">key</span>).<span class="ident">add</span>(<span class="ident">cookie</span>);
<span class="ident">jar</span>.<span class="ident">private_mut</span>(<span class="kw-2">&amp;</span><span class="ident">key</span>).<span class="ident">add</span>(<span class="ident">cookie</span>);
} <span class="kw">else</span> {
<span class="ident">jar</span>.<span class="ident">add_original</span>(<span class="ident">cookie</span>.<span class="ident">clone</span>());
<span class="ident">jar</span>.<span class="ident">private</span>(<span class="kw-2">&amp;</span><span class="ident">key</span>).<span class="ident">remove</span>(<span class="ident">cookie</span>);
<span class="ident">jar</span>.<span class="ident">private_mut</span>(<span class="kw-2">&amp;</span><span class="ident">key</span>).<span class="ident">remove</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>() {
@@ -959,17 +960,19 @@
<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">res</span> <span class="op">=</span> <span class="kw">if</span> <span class="self">self</span>.<span class="ident">legacy_supported</span>() {
<span class="ident">jar</span>.<span class="ident">private</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">key</span>).<span class="ident">get</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">name</span>).<span class="ident">map</span>(<span class="op">|</span><span class="ident">n</span><span class="op">|</span> <span class="ident">CookieValue</span> {
<span class="ident">identity</span>: <span class="ident">n</span>.<span class="ident">value</span>().<span class="ident">to_string</span>(),
<span class="ident">login_timestamp</span>: <span class="prelude-val">None</span>,
<span class="ident">visit_timestamp</span>: <span class="prelude-val">None</span>,
})
<span class="ident">jar</span>.<span class="ident">private_mut</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">key</span>)
.<span class="ident">get</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">name</span>)
.<span class="ident">map</span>(<span class="op">|</span><span class="ident">n</span><span class="op">|</span> <span class="ident">CookieValue</span> {
<span class="ident">identity</span>: <span class="ident">n</span>.<span class="ident">value</span>().<span class="ident">to_string</span>(),
<span class="ident">login_timestamp</span>: <span class="prelude-val">None</span>,
<span class="ident">visit_timestamp</span>: <span class="prelude-val">None</span>,
})
} <span class="kw">else</span> {
<span class="prelude-val">None</span>
};
<span class="ident">res</span>.<span class="ident">or_else</span>(<span class="op">|</span><span class="op">|</span> {
<span class="ident">jar</span>.<span class="ident">private</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">key_v2</span>)
<span class="ident">jar</span>.<span class="ident">private_mut</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">key_v2</span>)
.<span class="ident">get</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">name</span>)
.<span class="ident">and_then</span>(<span class="op">|</span><span class="ident">c</span><span class="op">|</span> <span class="self">self</span>.<span class="ident">parse</span>(<span class="ident">c</span>))
})
@@ -1222,7 +1225,7 @@
.<span class="ident">copied</span>()
.<span class="ident">collect</span>();
<span class="ident">jar</span>.<span class="ident">private</span>(<span class="kw-2">&amp;</span><span class="ident">Key::derive_from</span>(<span class="kw-2">&amp;</span><span class="ident">key</span>)).<span class="ident">add</span>(<span class="ident">Cookie::new</span>(
<span class="ident">jar</span>.<span class="ident">private_mut</span>(<span class="kw-2">&amp;</span><span class="ident">Key::derive_from</span>(<span class="kw-2">&amp;</span><span class="ident">key</span>)).<span class="ident">add</span>(<span class="ident">Cookie::new</span>(
<span class="ident">COOKIE_NAME</span>,
<span class="ident">serde_json::to_string</span>(<span class="kw-2">&amp;</span><span class="ident">CookieValue</span> {
<span class="ident">identity</span>: <span class="ident">identity</span>.<span class="ident">to_string</span>(),
@@ -1406,7 +1409,7 @@
<span class="kw">fn</span> <span class="ident">legacy_login_cookie</span>(<span class="ident">identity</span>: <span class="kw-2">&amp;</span><span class="lifetime">&#39;static</span> <span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Cookie</span><span class="op">&lt;</span><span class="lifetime">&#39;static</span><span class="op">&gt;</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</span>(<span class="kw-2">&amp;</span><span class="ident">Key::derive_from</span>(<span class="kw-2">&amp;</span><span class="ident">COOKIE_KEY_MASTER</span>))
<span class="ident">jar</span>.<span class="ident">private_mut</span>(<span class="kw-2">&amp;</span><span class="ident">Key::derive_from</span>(<span class="kw-2">&amp;</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>));
<span class="ident">jar</span>.<span class="ident">get</span>(<span class="ident">COOKIE_NAME</span>).<span class="ident">unwrap</span>().<span class="ident">clone</span>()
}
@@ -1423,7 +1426,7 @@
<span class="ident">cookies</span>.<span class="ident">add</span>(<span class="ident">Cookie::parse</span>(<span class="ident">cookie</span>.<span class="ident">to_str</span>().<span class="ident">unwrap</span>().<span class="ident">to_string</span>()).<span class="ident">unwrap</span>());
}
<span class="kw">let</span> <span class="ident">cookie</span> <span class="op">=</span> <span class="ident">cookies</span>
.<span class="ident">private</span>(<span class="kw-2">&amp;</span><span class="ident">Key::derive_from</span>(<span class="kw-2">&amp;</span><span class="ident">COOKIE_KEY_MASTER</span>))
.<span class="ident">private_mut</span>(<span class="kw-2">&amp;</span><span class="ident">Key::derive_from</span>(<span class="kw-2">&amp;</span><span class="ident">COOKIE_KEY_MASTER</span>))
.<span class="ident">get</span>(<span class="ident">COOKIE_NAME</span>)
.<span class="ident">unwrap</span>();
<span class="macro">assert_eq!</span>(<span class="ident">cookie</span>.<span class="ident">value</span>(), <span class="ident">identity</span>);
@@ -1657,5 +1660,6 @@
}
}
</pre></div>
</section><section id="search" class="content hidden"></section><section class="footer"></section><div id="rustdoc-vars" data-root-path="../../" data-current-crate="actix_identity" data-search-js="../../search-index.js"></div>
<script src="../../main.js"></script><script src="../../source-script.js"></script><script src="../../source-files.js"></script></body></html>
</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><script src="../../source-script.js"></script><script src="../../source-files.js"></script>
</body></html>