mirror of
https://github.com/actix/actix-extras.git
synced 2025-08-31 19:37:00 +02:00
Deploying to gh-pages from @ 90766e5d68
🚀
This commit is contained in:
File diff suppressed because it is too large
Load Diff
180
src/actix_settings/actix/address.rs.html
Normal file
180
src/actix_settings/actix/address.rs.html
Normal file
@@ -0,0 +1,180 @@
|
||||
<!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-settings/src/actix/address.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>address.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><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="../../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="../../../source-script.js"></script><script defer src="../../../source-files.js"></script><script defer src="../../../main.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"></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="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../actix_settings/index.html"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../wheel.svg"></a></div></div></form></nav></div><section id="main-content" 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>
|
||||
<span id="5">5</span>
|
||||
<span id="6">6</span>
|
||||
<span id="7">7</span>
|
||||
<span id="8">8</span>
|
||||
<span id="9">9</span>
|
||||
<span id="10">10</span>
|
||||
<span id="11">11</span>
|
||||
<span id="12">12</span>
|
||||
<span id="13">13</span>
|
||||
<span id="14">14</span>
|
||||
<span id="15">15</span>
|
||||
<span id="16">16</span>
|
||||
<span id="17">17</span>
|
||||
<span id="18">18</span>
|
||||
<span id="19">19</span>
|
||||
<span id="20">20</span>
|
||||
<span id="21">21</span>
|
||||
<span id="22">22</span>
|
||||
<span id="23">23</span>
|
||||
<span id="24">24</span>
|
||||
<span id="25">25</span>
|
||||
<span id="26">26</span>
|
||||
<span id="27">27</span>
|
||||
<span id="28">28</span>
|
||||
<span id="29">29</span>
|
||||
<span id="30">30</span>
|
||||
<span id="31">31</span>
|
||||
<span id="32">32</span>
|
||||
<span id="33">33</span>
|
||||
<span id="34">34</span>
|
||||
<span id="35">35</span>
|
||||
<span id="36">36</span>
|
||||
<span id="37">37</span>
|
||||
<span id="38">38</span>
|
||||
<span id="39">39</span>
|
||||
<span id="40">40</span>
|
||||
<span id="41">41</span>
|
||||
<span id="42">42</span>
|
||||
<span id="43">43</span>
|
||||
<span id="44">44</span>
|
||||
<span id="45">45</span>
|
||||
<span id="46">46</span>
|
||||
<span id="47">47</span>
|
||||
<span id="48">48</span>
|
||||
<span id="49">49</span>
|
||||
<span id="50">50</span>
|
||||
<span id="51">51</span>
|
||||
<span id="52">52</span>
|
||||
<span id="53">53</span>
|
||||
<span id="54">54</span>
|
||||
<span id="55">55</span>
|
||||
<span id="56">56</span>
|
||||
<span id="57">57</span>
|
||||
<span id="58">58</span>
|
||||
<span id="59">59</span>
|
||||
<span id="60">60</span>
|
||||
<span id="61">61</span>
|
||||
<span id="62">62</span>
|
||||
<span id="63">63</span>
|
||||
<span id="64">64</span>
|
||||
<span id="65">65</span>
|
||||
<span id="66">66</span>
|
||||
<span id="67">67</span>
|
||||
<span id="68">68</span>
|
||||
<span id="69">69</span>
|
||||
<span id="70">70</span>
|
||||
<span id="71">71</span>
|
||||
<span id="72">72</span>
|
||||
<span id="73">73</span>
|
||||
<span id="74">74</span>
|
||||
<span id="75">75</span>
|
||||
<span id="76">76</span>
|
||||
<span id="77">77</span>
|
||||
<span id="78">78</span>
|
||||
<span id="79">79</span>
|
||||
<span id="80">80</span>
|
||||
<span id="81">81</span>
|
||||
<span id="82">82</span>
|
||||
<span id="83">83</span>
|
||||
<span id="84">84</span>
|
||||
<span id="85">85</span>
|
||||
<span id="86">86</span>
|
||||
<span id="87">87</span>
|
||||
<span id="88">88</span>
|
||||
<span id="89">89</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">once_cell::sync::Lazy</span>;
|
||||
<span class="kw">use</span> <span class="ident">regex::Regex</span>;
|
||||
<span class="kw">use</span> <span class="ident">serde::Deserialize</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">core::Parse</span>, <span class="ident">error::AtError</span>};
|
||||
|
||||
<span class="kw">static</span> <span class="ident">ADDR_REGEX</span>: <span class="ident">Lazy</span><span class="op"><</span><span class="ident">Regex</span><span class="op">></span> <span class="op">=</span> <span class="ident">Lazy::new</span>(<span class="op">|</span><span class="op">|</span> {
|
||||
<span class="ident">Regex::new</span>(
|
||||
<span class="string">r#"(?x)
|
||||
\[ # opening square bracket
|
||||
(\s)* # optional whitespace
|
||||
"(?P<host>[^"]+)" # host name (string)
|
||||
, # separating comma
|
||||
(\s)* # optional whitespace
|
||||
(?P<port>\d+) # port number (integer)
|
||||
(\s)* # optional whitespace
|
||||
\] # closing square bracket
|
||||
"#</span>,
|
||||
)
|
||||
.<span class="ident">expect</span>(<span class="string">"Failed to compile regex: ADDR_REGEX"</span>)
|
||||
});
|
||||
|
||||
<span class="kw">static</span> <span class="ident">ADDR_LIST_REGEX</span>: <span class="ident">Lazy</span><span class="op"><</span><span class="ident">Regex</span><span class="op">></span> <span class="op">=</span> <span class="ident">Lazy::new</span>(<span class="op">|</span><span class="op">|</span> {
|
||||
<span class="ident">Regex::new</span>(
|
||||
<span class="string">r#"(?x)
|
||||
\[ # opening square bracket (list)
|
||||
(\s)* # optional whitespace
|
||||
(?P<elements>(
|
||||
\[".*", (\s)* \d+\] # element
|
||||
(,)? # element separator
|
||||
(\s)* # optional whitespace
|
||||
)*)
|
||||
(\s)* # optional whitespace
|
||||
\] # closing square bracket (list)
|
||||
"#</span>,
|
||||
)
|
||||
.<span class="ident">expect</span>(<span class="string">"Failed to compile regex: ADDRS_REGEX"</span>)
|
||||
});
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>, <span class="ident">Hash</span>, <span class="ident">Deserialize</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">Address</span> {
|
||||
<span class="kw">pub</span> <span class="ident">host</span>: <span class="ident">String</span>,
|
||||
<span class="kw">pub</span> <span class="ident">port</span>: <span class="ident">u16</span>,
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">Address</span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">string</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">AtError</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">items</span> <span class="op">=</span> <span class="ident">string</span>
|
||||
.<span class="ident">trim</span>()
|
||||
.<span class="ident">trim_start_matches</span>(<span class="string">'['</span>)
|
||||
.<span class="ident">trim_end_matches</span>(<span class="string">']'</span>)
|
||||
.<span class="ident">split</span>(<span class="string">','</span>);
|
||||
|
||||
<span class="kw">let</span> <span class="ident">parse_error</span> <span class="op">=</span> <span class="op">|</span><span class="op">|</span> <span class="ident">AtError::ParseAddressError</span>(<span class="ident">string</span>.<span class="ident">to_string</span>());
|
||||
|
||||
<span class="kw">if</span> <span class="op">!</span><span class="ident">ADDR_REGEX</span>.<span class="ident">is_match</span>(<span class="ident">string</span>) {
|
||||
<span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">parse_error</span>());
|
||||
}
|
||||
|
||||
<span class="prelude-val">Ok</span>(<span class="self">Self</span> {
|
||||
<span class="ident">host</span>: <span class="ident">items</span>.<span class="ident">next</span>().<span class="ident">ok_or_else</span>(<span class="ident">parse_error</span>)<span class="question-mark">?</span>.<span class="ident">trim</span>().<span class="ident">to_string</span>(),
|
||||
<span class="ident">port</span>: <span class="ident">items</span>.<span class="ident">next</span>().<span class="ident">ok_or_else</span>(<span class="ident">parse_error</span>)<span class="question-mark">?</span>.<span class="ident">trim</span>().<span class="ident">parse</span>()<span class="question-mark">?</span>,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">Vec</span><span class="op"><</span><span class="ident">Address</span><span class="op">></span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">string</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">AtError</span><span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">parse_error</span> <span class="op">=</span> <span class="op">|</span><span class="op">|</span> <span class="ident">AtError::ParseAddressError</span>(<span class="ident">string</span>.<span class="ident">to_string</span>());
|
||||
|
||||
<span class="kw">if</span> <span class="op">!</span><span class="ident">ADDR_LIST_REGEX</span>.<span class="ident">is_match</span>(<span class="ident">string</span>) {
|
||||
<span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">parse_error</span>());
|
||||
}
|
||||
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">addrs</span> <span class="op">=</span> <span class="macro">vec!</span>[];
|
||||
|
||||
<span class="kw">for</span> <span class="ident">list_caps</span> <span class="kw">in</span> <span class="ident">ADDR_LIST_REGEX</span>.<span class="ident">captures_iter</span>(<span class="ident">string</span>) {
|
||||
<span class="kw">let</span> <span class="ident">elements</span> <span class="op">=</span> <span class="kw-2">&</span><span class="ident">list_caps</span>[<span class="string">"elements"</span>].<span class="ident">trim</span>();
|
||||
<span class="kw">for</span> <span class="ident">elt_caps</span> <span class="kw">in</span> <span class="ident">ADDR_REGEX</span>.<span class="ident">captures_iter</span>(<span class="ident">elements</span>) {
|
||||
<span class="ident">addrs</span>.<span class="ident">push</span>(<span class="ident">Address</span> {
|
||||
<span class="ident">host</span>: <span class="ident">elt_caps</span>[<span class="string">"host"</span>].<span class="ident">to_string</span>(),
|
||||
<span class="ident">port</span>: <span class="ident">elt_caps</span>[<span class="string">"port"</span>].<span class="ident">parse</span>()<span class="question-mark">?</span>,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">addrs</span>)
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_settings" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (0f4bcadb4 2022-07-30)" ></div></body></html>
|
120
src/actix_settings/actix/backlog.rs.html
Normal file
120
src/actix_settings/actix/backlog.rs.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<!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-settings/src/actix/backlog.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>backlog.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><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="../../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="../../../source-script.js"></script><script defer src="../../../source-files.js"></script><script defer src="../../../main.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"></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="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../actix_settings/index.html"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../wheel.svg"></a></div></div></form></nav></div><section id="main-content" 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>
|
||||
<span id="5">5</span>
|
||||
<span id="6">6</span>
|
||||
<span id="7">7</span>
|
||||
<span id="8">8</span>
|
||||
<span id="9">9</span>
|
||||
<span id="10">10</span>
|
||||
<span id="11">11</span>
|
||||
<span id="12">12</span>
|
||||
<span id="13">13</span>
|
||||
<span id="14">14</span>
|
||||
<span id="15">15</span>
|
||||
<span id="16">16</span>
|
||||
<span id="17">17</span>
|
||||
<span id="18">18</span>
|
||||
<span id="19">19</span>
|
||||
<span id="20">20</span>
|
||||
<span id="21">21</span>
|
||||
<span id="22">22</span>
|
||||
<span id="23">23</span>
|
||||
<span id="24">24</span>
|
||||
<span id="25">25</span>
|
||||
<span id="26">26</span>
|
||||
<span id="27">27</span>
|
||||
<span id="28">28</span>
|
||||
<span id="29">29</span>
|
||||
<span id="30">30</span>
|
||||
<span id="31">31</span>
|
||||
<span id="32">32</span>
|
||||
<span id="33">33</span>
|
||||
<span id="34">34</span>
|
||||
<span id="35">35</span>
|
||||
<span id="36">36</span>
|
||||
<span id="37">37</span>
|
||||
<span id="38">38</span>
|
||||
<span id="39">39</span>
|
||||
<span id="40">40</span>
|
||||
<span id="41">41</span>
|
||||
<span id="42">42</span>
|
||||
<span id="43">43</span>
|
||||
<span id="44">44</span>
|
||||
<span id="45">45</span>
|
||||
<span id="46">46</span>
|
||||
<span id="47">47</span>
|
||||
<span id="48">48</span>
|
||||
<span id="49">49</span>
|
||||
<span id="50">50</span>
|
||||
<span id="51">51</span>
|
||||
<span id="52">52</span>
|
||||
<span id="53">53</span>
|
||||
<span id="54">54</span>
|
||||
<span id="55">55</span>
|
||||
<span id="56">56</span>
|
||||
<span id="57">57</span>
|
||||
<span id="58">58</span>
|
||||
<span id="59">59</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">serde::de</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">core::Parse</span>, <span class="ident">error::AtError</span>};
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>, <span class="ident">Hash</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">Backlog</span> {
|
||||
<span class="ident">Default</span>,
|
||||
<span class="ident">Manual</span>(<span class="ident">usize</span>),
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">Backlog</span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">string</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="ident">std::result::Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">AtError</span><span class="op">></span> {
|
||||
<span class="kw">match</span> <span class="ident">string</span> {
|
||||
<span class="string">"default"</span> => <span class="prelude-val">Ok</span>(<span class="ident">Backlog::Default</span>),
|
||||
<span class="ident">string</span> => <span class="kw">match</span> <span class="ident">string</span>.<span class="ident">parse</span>::<span class="op"><</span><span class="ident">usize</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">Backlog::Manual</span>(<span class="ident">val</span>)),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="prelude-val">Err</span>(<span class="macro">InvalidValue!</span> {
|
||||
<span class="ident">expected</span>: <span class="string">"an integer > 0"</span>,
|
||||
<span class="ident">got</span>: <span class="ident">string</span>,
|
||||
}),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Deserialize</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">Backlog</span> {
|
||||
<span class="kw">fn</span> <span class="ident">deserialize</span><span class="op"><</span><span class="ident">D</span><span class="op">></span>(<span class="ident">deserializer</span>: <span class="ident">D</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">D::Error</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">D</span>: <span class="ident">de::Deserializer</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span>,
|
||||
{
|
||||
<span class="kw">struct</span> <span class="ident">BacklogVisitor</span>;
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Visitor</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">BacklogVisitor</span> {
|
||||
<span class="kw">type</span> <span class="ident">Value</span> <span class="op">=</span> <span class="ident">Backlog</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">expecting</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">formatter</span>: <span class="kw-2">&mut</span> <span class="ident">fmt::Formatter</span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">let</span> <span class="ident">msg</span> <span class="op">=</span> <span class="string">"Either \"default\" or a string containing an integer > 0"</span>;
|
||||
<span class="ident">formatter</span>.<span class="ident">write_str</span>(<span class="ident">msg</span>)
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">visit_str</span><span class="op"><</span><span class="ident">E</span><span class="op">></span>(<span class="self">self</span>, <span class="ident">value</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Value</span>, <span class="ident">E</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">E</span>: <span class="ident">de::Error</span>,
|
||||
{
|
||||
<span class="kw">match</span> <span class="ident">Backlog::parse</span>(<span class="ident">value</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">backlog</span>) => <span class="prelude-val">Ok</span>(<span class="ident">backlog</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">AtError::InvalidValue</span> { <span class="ident">expected</span>, <span class="ident">got</span>, .. }) => <span class="prelude-val">Err</span>(
|
||||
<span class="ident">de::Error::invalid_value</span>(<span class="ident">de::Unexpected::Str</span>(<span class="kw-2">&</span><span class="ident">got</span>), <span class="kw-2">&</span><span class="ident">expected</span>),
|
||||
),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="macro">unreachable!</span>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="ident">deserializer</span>.<span class="ident">deserialize_string</span>(<span class="ident">BacklogVisitor</span>)
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_settings" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (0f4bcadb4 2022-07-30)" ></div></body></html>
|
166
src/actix_settings/actix/keep_alive.rs.html
Normal file
166
src/actix_settings/actix/keep_alive.rs.html
Normal file
@@ -0,0 +1,166 @@
|
||||
<!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-settings/src/actix/keep_alive.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>keep_alive.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><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="../../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="../../../source-script.js"></script><script defer src="../../../source-files.js"></script><script defer src="../../../main.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"></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="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../actix_settings/index.html"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../wheel.svg"></a></div></div></form></nav></div><section id="main-content" 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>
|
||||
<span id="5">5</span>
|
||||
<span id="6">6</span>
|
||||
<span id="7">7</span>
|
||||
<span id="8">8</span>
|
||||
<span id="9">9</span>
|
||||
<span id="10">10</span>
|
||||
<span id="11">11</span>
|
||||
<span id="12">12</span>
|
||||
<span id="13">13</span>
|
||||
<span id="14">14</span>
|
||||
<span id="15">15</span>
|
||||
<span id="16">16</span>
|
||||
<span id="17">17</span>
|
||||
<span id="18">18</span>
|
||||
<span id="19">19</span>
|
||||
<span id="20">20</span>
|
||||
<span id="21">21</span>
|
||||
<span id="22">22</span>
|
||||
<span id="23">23</span>
|
||||
<span id="24">24</span>
|
||||
<span id="25">25</span>
|
||||
<span id="26">26</span>
|
||||
<span id="27">27</span>
|
||||
<span id="28">28</span>
|
||||
<span id="29">29</span>
|
||||
<span id="30">30</span>
|
||||
<span id="31">31</span>
|
||||
<span id="32">32</span>
|
||||
<span id="33">33</span>
|
||||
<span id="34">34</span>
|
||||
<span id="35">35</span>
|
||||
<span id="36">36</span>
|
||||
<span id="37">37</span>
|
||||
<span id="38">38</span>
|
||||
<span id="39">39</span>
|
||||
<span id="40">40</span>
|
||||
<span id="41">41</span>
|
||||
<span id="42">42</span>
|
||||
<span id="43">43</span>
|
||||
<span id="44">44</span>
|
||||
<span id="45">45</span>
|
||||
<span id="46">46</span>
|
||||
<span id="47">47</span>
|
||||
<span id="48">48</span>
|
||||
<span id="49">49</span>
|
||||
<span id="50">50</span>
|
||||
<span id="51">51</span>
|
||||
<span id="52">52</span>
|
||||
<span id="53">53</span>
|
||||
<span id="54">54</span>
|
||||
<span id="55">55</span>
|
||||
<span id="56">56</span>
|
||||
<span id="57">57</span>
|
||||
<span id="58">58</span>
|
||||
<span id="59">59</span>
|
||||
<span id="60">60</span>
|
||||
<span id="61">61</span>
|
||||
<span id="62">62</span>
|
||||
<span id="63">63</span>
|
||||
<span id="64">64</span>
|
||||
<span id="65">65</span>
|
||||
<span id="66">66</span>
|
||||
<span id="67">67</span>
|
||||
<span id="68">68</span>
|
||||
<span id="69">69</span>
|
||||
<span id="70">70</span>
|
||||
<span id="71">71</span>
|
||||
<span id="72">72</span>
|
||||
<span id="73">73</span>
|
||||
<span id="74">74</span>
|
||||
<span id="75">75</span>
|
||||
<span id="76">76</span>
|
||||
<span id="77">77</span>
|
||||
<span id="78">78</span>
|
||||
<span id="79">79</span>
|
||||
<span id="80">80</span>
|
||||
<span id="81">81</span>
|
||||
<span id="82">82</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">once_cell::sync::Lazy</span>;
|
||||
<span class="kw">use</span> <span class="ident">regex::Regex</span>;
|
||||
<span class="kw">use</span> <span class="ident">serde::de</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">core::Parse</span>, <span class="ident">error::AtError</span>};
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>, <span class="ident">Hash</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">KeepAlive</span> {
|
||||
<span class="ident">Default</span>,
|
||||
<span class="ident">Disabled</span>,
|
||||
<span class="ident">Os</span>,
|
||||
<span class="ident">Seconds</span>(<span class="ident">usize</span>),
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">KeepAlive</span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">string</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="ident">std::result::Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">AtError</span><span class="op">></span> {
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">static</span> <span class="ident">FMT</span>: <span class="ident">Lazy</span><span class="op"><</span><span class="ident">Regex</span><span class="op">></span> <span class="op">=</span>
|
||||
<span class="ident">Lazy::new</span>(<span class="op">|</span><span class="op">|</span> <span class="ident">Regex::new</span>(<span class="string">r"^\d+ seconds$"</span>).<span class="ident">expect</span>(<span class="string">"Failed to compile regex: FMT"</span>));
|
||||
|
||||
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">static</span> <span class="ident">DIGITS</span>: <span class="ident">Lazy</span><span class="op"><</span><span class="ident">Regex</span><span class="op">></span> <span class="op">=</span>
|
||||
<span class="ident">Lazy::new</span>(<span class="op">|</span><span class="op">|</span> <span class="ident">Regex::new</span>(<span class="string">r"^\d+"</span>).<span class="ident">expect</span>(<span class="string">"Failed to compile regex: FMT"</span>));
|
||||
|
||||
<span class="macro">macro_rules!</span> <span class="ident">invalid_value</span> {
|
||||
(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">got</span>:<span class="ident">expr</span>) => {
|
||||
<span class="prelude-val">Err</span>(<span class="macro">InvalidValue!</span> {
|
||||
<span class="ident">expected</span>: <span class="string">"a string of the format \"N seconds\" where N is an integer > 0"</span>,
|
||||
<span class="ident">got</span>: <span class="macro-nonterminal">$</span><span class="macro-nonterminal">got</span>,
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
<span class="kw">let</span> <span class="ident">digits_in</span> <span class="op">=</span> <span class="op">|</span><span class="ident">m</span>: <span class="ident">regex::Match</span><span class="op">|</span> <span class="kw-2">&</span><span class="ident">string</span>[<span class="ident">m</span>.<span class="ident">start</span>()..<span class="ident">m</span>.<span class="ident">end</span>()];
|
||||
<span class="kw">match</span> <span class="ident">string</span> {
|
||||
<span class="string">"default"</span> => <span class="prelude-val">Ok</span>(<span class="ident">KeepAlive::Default</span>),
|
||||
<span class="string">"disabled"</span> => <span class="prelude-val">Ok</span>(<span class="ident">KeepAlive::Disabled</span>),
|
||||
<span class="string">"OS"</span> <span class="op">|</span> <span class="string">"os"</span> => <span class="prelude-val">Ok</span>(<span class="ident">KeepAlive::Os</span>),
|
||||
<span class="ident">string</span> <span class="kw">if</span> <span class="op">!</span><span class="ident">FMT</span>.<span class="ident">is_match</span>(<span class="ident">string</span>) => <span class="macro">invalid_value!</span>(<span class="ident">string</span>),
|
||||
<span class="ident">string</span> => <span class="kw">match</span> <span class="ident">DIGITS</span>.<span class="ident">find</span>(<span class="ident">string</span>) {
|
||||
<span class="prelude-val">None</span> => <span class="macro">invalid_value!</span>(<span class="ident">string</span>),
|
||||
<span class="prelude-val">Some</span>(<span class="ident">mat</span>) => <span class="kw">match</span> <span class="ident">digits_in</span>(<span class="ident">mat</span>).<span class="ident">parse</span>() {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">val</span>) => <span class="prelude-val">Ok</span>(<span class="ident">KeepAlive::Seconds</span>(<span class="ident">val</span>)),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="macro">invalid_value!</span>(<span class="ident">string</span>),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Deserialize</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">KeepAlive</span> {
|
||||
<span class="kw">fn</span> <span class="ident">deserialize</span><span class="op"><</span><span class="ident">D</span><span class="op">></span>(<span class="ident">deserializer</span>: <span class="ident">D</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">D::Error</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">D</span>: <span class="ident">de::Deserializer</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span>,
|
||||
{
|
||||
<span class="kw">struct</span> <span class="ident">KeepAliveVisitor</span>;
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Visitor</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">KeepAliveVisitor</span> {
|
||||
<span class="kw">type</span> <span class="ident">Value</span> <span class="op">=</span> <span class="ident">KeepAlive</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">expecting</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">formatter</span>: <span class="kw-2">&mut</span> <span class="ident">fmt::Formatter</span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">let</span> <span class="ident">msg</span> <span class="op">=</span> <span class="string">"Either \"default\", \"disabled\", \"os\", or a string of the format \"N seconds\" where N is an integer > 0"</span>;
|
||||
<span class="ident">formatter</span>.<span class="ident">write_str</span>(<span class="ident">msg</span>)
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">visit_str</span><span class="op"><</span><span class="ident">E</span><span class="op">></span>(<span class="self">self</span>, <span class="ident">value</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Value</span>, <span class="ident">E</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">E</span>: <span class="ident">de::Error</span>,
|
||||
{
|
||||
<span class="kw">match</span> <span class="ident">KeepAlive::parse</span>(<span class="ident">value</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">keep_alive</span>) => <span class="prelude-val">Ok</span>(<span class="ident">keep_alive</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">AtError::InvalidValue</span> { <span class="ident">expected</span>, <span class="ident">got</span>, .. }) => <span class="prelude-val">Err</span>(
|
||||
<span class="ident">de::Error::invalid_value</span>(<span class="ident">de::Unexpected::Str</span>(<span class="kw-2">&</span><span class="ident">got</span>), <span class="kw-2">&</span><span class="ident">expected</span>),
|
||||
),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="macro">unreachable!</span>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="ident">deserializer</span>.<span class="ident">deserialize_string</span>(<span class="ident">KeepAliveVisitor</span>)
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_settings" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (0f4bcadb4 2022-07-30)" ></div></body></html>
|
120
src/actix_settings/actix/max_connection_rate.rs.html
Normal file
120
src/actix_settings/actix/max_connection_rate.rs.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<!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-settings/src/actix/max_connection_rate.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>max_connection_rate.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><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="../../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="../../../source-script.js"></script><script defer src="../../../source-files.js"></script><script defer src="../../../main.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"></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="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../actix_settings/index.html"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../wheel.svg"></a></div></div></form></nav></div><section id="main-content" 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>
|
||||
<span id="5">5</span>
|
||||
<span id="6">6</span>
|
||||
<span id="7">7</span>
|
||||
<span id="8">8</span>
|
||||
<span id="9">9</span>
|
||||
<span id="10">10</span>
|
||||
<span id="11">11</span>
|
||||
<span id="12">12</span>
|
||||
<span id="13">13</span>
|
||||
<span id="14">14</span>
|
||||
<span id="15">15</span>
|
||||
<span id="16">16</span>
|
||||
<span id="17">17</span>
|
||||
<span id="18">18</span>
|
||||
<span id="19">19</span>
|
||||
<span id="20">20</span>
|
||||
<span id="21">21</span>
|
||||
<span id="22">22</span>
|
||||
<span id="23">23</span>
|
||||
<span id="24">24</span>
|
||||
<span id="25">25</span>
|
||||
<span id="26">26</span>
|
||||
<span id="27">27</span>
|
||||
<span id="28">28</span>
|
||||
<span id="29">29</span>
|
||||
<span id="30">30</span>
|
||||
<span id="31">31</span>
|
||||
<span id="32">32</span>
|
||||
<span id="33">33</span>
|
||||
<span id="34">34</span>
|
||||
<span id="35">35</span>
|
||||
<span id="36">36</span>
|
||||
<span id="37">37</span>
|
||||
<span id="38">38</span>
|
||||
<span id="39">39</span>
|
||||
<span id="40">40</span>
|
||||
<span id="41">41</span>
|
||||
<span id="42">42</span>
|
||||
<span id="43">43</span>
|
||||
<span id="44">44</span>
|
||||
<span id="45">45</span>
|
||||
<span id="46">46</span>
|
||||
<span id="47">47</span>
|
||||
<span id="48">48</span>
|
||||
<span id="49">49</span>
|
||||
<span id="50">50</span>
|
||||
<span id="51">51</span>
|
||||
<span id="52">52</span>
|
||||
<span id="53">53</span>
|
||||
<span id="54">54</span>
|
||||
<span id="55">55</span>
|
||||
<span id="56">56</span>
|
||||
<span id="57">57</span>
|
||||
<span id="58">58</span>
|
||||
<span id="59">59</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">serde::de</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">core::Parse</span>, <span class="ident">error::AtError</span>};
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>, <span class="ident">Hash</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">MaxConnectionRate</span> {
|
||||
<span class="ident">Default</span>,
|
||||
<span class="ident">Manual</span>(<span class="ident">usize</span>),
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">MaxConnectionRate</span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">string</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="ident">std::result::Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">AtError</span><span class="op">></span> {
|
||||
<span class="kw">match</span> <span class="ident">string</span> {
|
||||
<span class="string">"default"</span> => <span class="prelude-val">Ok</span>(<span class="ident">MaxConnectionRate::Default</span>),
|
||||
<span class="ident">string</span> => <span class="kw">match</span> <span class="ident">string</span>.<span class="ident">parse</span>::<span class="op"><</span><span class="ident">usize</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">MaxConnectionRate::Manual</span>(<span class="ident">val</span>)),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="prelude-val">Err</span>(<span class="macro">InvalidValue!</span> {
|
||||
<span class="ident">expected</span>: <span class="string">"an integer > 0"</span>,
|
||||
<span class="ident">got</span>: <span class="ident">string</span>,
|
||||
}),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Deserialize</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">MaxConnectionRate</span> {
|
||||
<span class="kw">fn</span> <span class="ident">deserialize</span><span class="op"><</span><span class="ident">D</span><span class="op">></span>(<span class="ident">deserializer</span>: <span class="ident">D</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">D::Error</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">D</span>: <span class="ident">de::Deserializer</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span>,
|
||||
{
|
||||
<span class="kw">struct</span> <span class="ident">MaxConnectionRateVisitor</span>;
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Visitor</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">MaxConnectionRateVisitor</span> {
|
||||
<span class="kw">type</span> <span class="ident">Value</span> <span class="op">=</span> <span class="ident">MaxConnectionRate</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">expecting</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">formatter</span>: <span class="kw-2">&mut</span> <span class="ident">fmt::Formatter</span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">let</span> <span class="ident">msg</span> <span class="op">=</span> <span class="string">"Either \"default\" or a string containing an integer > 0"</span>;
|
||||
<span class="ident">formatter</span>.<span class="ident">write_str</span>(<span class="ident">msg</span>)
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">visit_str</span><span class="op"><</span><span class="ident">E</span><span class="op">></span>(<span class="self">self</span>, <span class="ident">value</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Value</span>, <span class="ident">E</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">E</span>: <span class="ident">de::Error</span>,
|
||||
{
|
||||
<span class="kw">match</span> <span class="ident">MaxConnectionRate::parse</span>(<span class="ident">value</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">max_connection_rate</span>) => <span class="prelude-val">Ok</span>(<span class="ident">max_connection_rate</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">AtError::InvalidValue</span> { <span class="ident">expected</span>, <span class="ident">got</span>, .. }) => <span class="prelude-val">Err</span>(
|
||||
<span class="ident">de::Error::invalid_value</span>(<span class="ident">de::Unexpected::Str</span>(<span class="kw-2">&</span><span class="ident">got</span>), <span class="kw-2">&</span><span class="ident">expected</span>),
|
||||
),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="macro">unreachable!</span>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="ident">deserializer</span>.<span class="ident">deserialize_string</span>(<span class="ident">MaxConnectionRateVisitor</span>)
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_settings" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (0f4bcadb4 2022-07-30)" ></div></body></html>
|
120
src/actix_settings/actix/max_connections.rs.html
Normal file
120
src/actix_settings/actix/max_connections.rs.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<!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-settings/src/actix/max_connections.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>max_connections.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><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="../../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="../../../source-script.js"></script><script defer src="../../../source-files.js"></script><script defer src="../../../main.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"></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="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../actix_settings/index.html"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../wheel.svg"></a></div></div></form></nav></div><section id="main-content" 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>
|
||||
<span id="5">5</span>
|
||||
<span id="6">6</span>
|
||||
<span id="7">7</span>
|
||||
<span id="8">8</span>
|
||||
<span id="9">9</span>
|
||||
<span id="10">10</span>
|
||||
<span id="11">11</span>
|
||||
<span id="12">12</span>
|
||||
<span id="13">13</span>
|
||||
<span id="14">14</span>
|
||||
<span id="15">15</span>
|
||||
<span id="16">16</span>
|
||||
<span id="17">17</span>
|
||||
<span id="18">18</span>
|
||||
<span id="19">19</span>
|
||||
<span id="20">20</span>
|
||||
<span id="21">21</span>
|
||||
<span id="22">22</span>
|
||||
<span id="23">23</span>
|
||||
<span id="24">24</span>
|
||||
<span id="25">25</span>
|
||||
<span id="26">26</span>
|
||||
<span id="27">27</span>
|
||||
<span id="28">28</span>
|
||||
<span id="29">29</span>
|
||||
<span id="30">30</span>
|
||||
<span id="31">31</span>
|
||||
<span id="32">32</span>
|
||||
<span id="33">33</span>
|
||||
<span id="34">34</span>
|
||||
<span id="35">35</span>
|
||||
<span id="36">36</span>
|
||||
<span id="37">37</span>
|
||||
<span id="38">38</span>
|
||||
<span id="39">39</span>
|
||||
<span id="40">40</span>
|
||||
<span id="41">41</span>
|
||||
<span id="42">42</span>
|
||||
<span id="43">43</span>
|
||||
<span id="44">44</span>
|
||||
<span id="45">45</span>
|
||||
<span id="46">46</span>
|
||||
<span id="47">47</span>
|
||||
<span id="48">48</span>
|
||||
<span id="49">49</span>
|
||||
<span id="50">50</span>
|
||||
<span id="51">51</span>
|
||||
<span id="52">52</span>
|
||||
<span id="53">53</span>
|
||||
<span id="54">54</span>
|
||||
<span id="55">55</span>
|
||||
<span id="56">56</span>
|
||||
<span id="57">57</span>
|
||||
<span id="58">58</span>
|
||||
<span id="59">59</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">serde::de</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">core::Parse</span>, <span class="ident">error::AtError</span>};
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>, <span class="ident">Hash</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">MaxConnections</span> {
|
||||
<span class="ident">Default</span>,
|
||||
<span class="ident">Manual</span>(<span class="ident">usize</span>),
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">MaxConnections</span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">string</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="ident">std::result::Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">AtError</span><span class="op">></span> {
|
||||
<span class="kw">match</span> <span class="ident">string</span> {
|
||||
<span class="string">"default"</span> => <span class="prelude-val">Ok</span>(<span class="ident">MaxConnections::Default</span>),
|
||||
<span class="ident">string</span> => <span class="kw">match</span> <span class="ident">string</span>.<span class="ident">parse</span>::<span class="op"><</span><span class="ident">usize</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">MaxConnections::Manual</span>(<span class="ident">val</span>)),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="prelude-val">Err</span>(<span class="macro">InvalidValue!</span> {
|
||||
<span class="ident">expected</span>: <span class="string">"an integer > 0"</span>,
|
||||
<span class="ident">got</span>: <span class="ident">string</span>,
|
||||
}),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Deserialize</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">MaxConnections</span> {
|
||||
<span class="kw">fn</span> <span class="ident">deserialize</span><span class="op"><</span><span class="ident">D</span><span class="op">></span>(<span class="ident">deserializer</span>: <span class="ident">D</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">D::Error</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">D</span>: <span class="ident">de::Deserializer</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span>,
|
||||
{
|
||||
<span class="kw">struct</span> <span class="ident">MaxConnectionsVisitor</span>;
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Visitor</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">MaxConnectionsVisitor</span> {
|
||||
<span class="kw">type</span> <span class="ident">Value</span> <span class="op">=</span> <span class="ident">MaxConnections</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">expecting</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">formatter</span>: <span class="kw-2">&mut</span> <span class="ident">fmt::Formatter</span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">let</span> <span class="ident">msg</span> <span class="op">=</span> <span class="string">"Either \"default\" or a string containing an integer > 0"</span>;
|
||||
<span class="ident">formatter</span>.<span class="ident">write_str</span>(<span class="ident">msg</span>)
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">visit_str</span><span class="op"><</span><span class="ident">E</span><span class="op">></span>(<span class="self">self</span>, <span class="ident">value</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Value</span>, <span class="ident">E</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">E</span>: <span class="ident">de::Error</span>,
|
||||
{
|
||||
<span class="kw">match</span> <span class="ident">MaxConnections::parse</span>(<span class="ident">value</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">max_connections</span>) => <span class="prelude-val">Ok</span>(<span class="ident">max_connections</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">AtError::InvalidValue</span> { <span class="ident">expected</span>, <span class="ident">got</span>, .. }) => <span class="prelude-val">Err</span>(
|
||||
<span class="ident">de::Error::invalid_value</span>(<span class="ident">de::Unexpected::Str</span>(<span class="kw-2">&</span><span class="ident">got</span>), <span class="kw-2">&</span><span class="ident">expected</span>),
|
||||
),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="macro">unreachable!</span>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="ident">deserializer</span>.<span class="ident">deserialize_string</span>(<span class="ident">MaxConnectionsVisitor</span>)
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_settings" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (0f4bcadb4 2022-07-30)" ></div></body></html>
|
52
src/actix_settings/actix/mode.rs.html
Normal file
52
src/actix_settings/actix/mode.rs.html
Normal file
@@ -0,0 +1,52 @@
|
||||
<!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-settings/src/actix/mode.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>mode.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><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="../../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="../../../source-script.js"></script><script defer src="../../../source-files.js"></script><script defer src="../../../main.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"></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="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../actix_settings/index.html"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../wheel.svg"></a></div></div></form></nav></div><section id="main-content" 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>
|
||||
<span id="5">5</span>
|
||||
<span id="6">6</span>
|
||||
<span id="7">7</span>
|
||||
<span id="8">8</span>
|
||||
<span id="9">9</span>
|
||||
<span id="10">10</span>
|
||||
<span id="11">11</span>
|
||||
<span id="12">12</span>
|
||||
<span id="13">13</span>
|
||||
<span id="14">14</span>
|
||||
<span id="15">15</span>
|
||||
<span id="16">16</span>
|
||||
<span id="17">17</span>
|
||||
<span id="18">18</span>
|
||||
<span id="19">19</span>
|
||||
<span id="20">20</span>
|
||||
<span id="21">21</span>
|
||||
<span id="22">22</span>
|
||||
<span id="23">23</span>
|
||||
<span id="24">24</span>
|
||||
<span id="25">25</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">serde::Deserialize</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">core::Parse</span>, <span class="ident">error::AtError</span>};
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>, <span class="ident">Hash</span>, <span class="ident">Deserialize</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">Mode</span> {
|
||||
<span class="attribute">#[<span class="ident">serde</span>(<span class="ident">rename</span> <span class="op">=</span> <span class="string">"development"</span>)]</span>
|
||||
<span class="ident">Development</span>,
|
||||
|
||||
<span class="attribute">#[<span class="ident">serde</span>(<span class="ident">rename</span> <span class="op">=</span> <span class="string">"production"</span>)]</span>
|
||||
<span class="ident">Production</span>,
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">Mode</span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">string</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="ident">std::result::Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">AtError</span><span class="op">></span> {
|
||||
<span class="kw">match</span> <span class="ident">string</span> {
|
||||
<span class="string">"development"</span> => <span class="prelude-val">Ok</span>(<span class="ident"><span class="self">Self</span>::Development</span>),
|
||||
<span class="string">"production"</span> => <span class="prelude-val">Ok</span>(<span class="ident"><span class="self">Self</span>::Production</span>),
|
||||
<span class="kw">_</span> => <span class="prelude-val">Err</span>(<span class="macro">InvalidValue!</span> {
|
||||
<span class="ident">expected</span>: <span class="string">"\"development\" | \"production\"."</span>,
|
||||
<span class="ident">got</span>: <span class="ident">string</span>,
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_settings" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (0f4bcadb4 2022-07-30)" ></div></body></html>
|
120
src/actix_settings/actix/num_workers.rs.html
Normal file
120
src/actix_settings/actix/num_workers.rs.html
Normal file
@@ -0,0 +1,120 @@
|
||||
<!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-settings/src/actix/num_workers.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>num_workers.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><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="../../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="../../../source-script.js"></script><script defer src="../../../source-files.js"></script><script defer src="../../../main.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"></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="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../actix_settings/index.html"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../wheel.svg"></a></div></div></form></nav></div><section id="main-content" 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>
|
||||
<span id="5">5</span>
|
||||
<span id="6">6</span>
|
||||
<span id="7">7</span>
|
||||
<span id="8">8</span>
|
||||
<span id="9">9</span>
|
||||
<span id="10">10</span>
|
||||
<span id="11">11</span>
|
||||
<span id="12">12</span>
|
||||
<span id="13">13</span>
|
||||
<span id="14">14</span>
|
||||
<span id="15">15</span>
|
||||
<span id="16">16</span>
|
||||
<span id="17">17</span>
|
||||
<span id="18">18</span>
|
||||
<span id="19">19</span>
|
||||
<span id="20">20</span>
|
||||
<span id="21">21</span>
|
||||
<span id="22">22</span>
|
||||
<span id="23">23</span>
|
||||
<span id="24">24</span>
|
||||
<span id="25">25</span>
|
||||
<span id="26">26</span>
|
||||
<span id="27">27</span>
|
||||
<span id="28">28</span>
|
||||
<span id="29">29</span>
|
||||
<span id="30">30</span>
|
||||
<span id="31">31</span>
|
||||
<span id="32">32</span>
|
||||
<span id="33">33</span>
|
||||
<span id="34">34</span>
|
||||
<span id="35">35</span>
|
||||
<span id="36">36</span>
|
||||
<span id="37">37</span>
|
||||
<span id="38">38</span>
|
||||
<span id="39">39</span>
|
||||
<span id="40">40</span>
|
||||
<span id="41">41</span>
|
||||
<span id="42">42</span>
|
||||
<span id="43">43</span>
|
||||
<span id="44">44</span>
|
||||
<span id="45">45</span>
|
||||
<span id="46">46</span>
|
||||
<span id="47">47</span>
|
||||
<span id="48">48</span>
|
||||
<span id="49">49</span>
|
||||
<span id="50">50</span>
|
||||
<span id="51">51</span>
|
||||
<span id="52">52</span>
|
||||
<span id="53">53</span>
|
||||
<span id="54">54</span>
|
||||
<span id="55">55</span>
|
||||
<span id="56">56</span>
|
||||
<span id="57">57</span>
|
||||
<span id="58">58</span>
|
||||
<span id="59">59</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">serde::de</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">core::Parse</span>, <span class="ident">error::AtError</span>};
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>, <span class="ident">Hash</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">NumWorkers</span> {
|
||||
<span class="ident">Default</span>,
|
||||
<span class="ident">Manual</span>(<span class="ident">usize</span>),
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">NumWorkers</span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">string</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="ident">std::result::Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">AtError</span><span class="op">></span> {
|
||||
<span class="kw">match</span> <span class="ident">string</span> {
|
||||
<span class="string">"default"</span> => <span class="prelude-val">Ok</span>(<span class="ident">NumWorkers::Default</span>),
|
||||
<span class="ident">string</span> => <span class="kw">match</span> <span class="ident">string</span>.<span class="ident">parse</span>::<span class="op"><</span><span class="ident">usize</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">NumWorkers::Manual</span>(<span class="ident">val</span>)),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="prelude-val">Err</span>(<span class="macro">InvalidValue!</span> {
|
||||
<span class="ident">expected</span>: <span class="string">"a positive integer"</span>,
|
||||
<span class="ident">got</span>: <span class="ident">string</span>,
|
||||
}),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Deserialize</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">NumWorkers</span> {
|
||||
<span class="kw">fn</span> <span class="ident">deserialize</span><span class="op"><</span><span class="ident">D</span><span class="op">></span>(<span class="ident">deserializer</span>: <span class="ident">D</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">D::Error</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">D</span>: <span class="ident">de::Deserializer</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span>,
|
||||
{
|
||||
<span class="kw">struct</span> <span class="ident">NumWorkersVisitor</span>;
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Visitor</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">NumWorkersVisitor</span> {
|
||||
<span class="kw">type</span> <span class="ident">Value</span> <span class="op">=</span> <span class="ident">NumWorkers</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">expecting</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">formatter</span>: <span class="kw-2">&mut</span> <span class="ident">fmt::Formatter</span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">let</span> <span class="ident">msg</span> <span class="op">=</span> <span class="string">"Either \"default\" or a string containing an integer > 0"</span>;
|
||||
<span class="ident">formatter</span>.<span class="ident">write_str</span>(<span class="ident">msg</span>)
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">visit_str</span><span class="op"><</span><span class="ident">E</span><span class="op">></span>(<span class="self">self</span>, <span class="ident">value</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Value</span>, <span class="ident">E</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">E</span>: <span class="ident">de::Error</span>,
|
||||
{
|
||||
<span class="kw">match</span> <span class="ident">NumWorkers::parse</span>(<span class="ident">value</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">num_workers</span>) => <span class="prelude-val">Ok</span>(<span class="ident">num_workers</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">AtError::InvalidValue</span> { <span class="ident">expected</span>, <span class="ident">got</span>, .. }) => <span class="prelude-val">Err</span>(
|
||||
<span class="ident">de::Error::invalid_value</span>(<span class="ident">de::Unexpected::Str</span>(<span class="kw-2">&</span><span class="ident">got</span>), <span class="kw-2">&</span><span class="ident">expected</span>),
|
||||
),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="macro">unreachable!</span>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="ident">deserializer</span>.<span class="ident">deserialize_string</span>(<span class="ident">NumWorkersVisitor</span>)
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_settings" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (0f4bcadb4 2022-07-30)" ></div></body></html>
|
178
src/actix_settings/actix/timeout.rs.html
Normal file
178
src/actix_settings/actix/timeout.rs.html
Normal file
@@ -0,0 +1,178 @@
|
||||
<!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-settings/src/actix/timeout.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>timeout.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><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="../../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="../../../source-script.js"></script><script defer src="../../../source-files.js"></script><script defer src="../../../main.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"></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="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../actix_settings/index.html"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../wheel.svg"></a></div></div></form></nav></div><section id="main-content" 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>
|
||||
<span id="5">5</span>
|
||||
<span id="6">6</span>
|
||||
<span id="7">7</span>
|
||||
<span id="8">8</span>
|
||||
<span id="9">9</span>
|
||||
<span id="10">10</span>
|
||||
<span id="11">11</span>
|
||||
<span id="12">12</span>
|
||||
<span id="13">13</span>
|
||||
<span id="14">14</span>
|
||||
<span id="15">15</span>
|
||||
<span id="16">16</span>
|
||||
<span id="17">17</span>
|
||||
<span id="18">18</span>
|
||||
<span id="19">19</span>
|
||||
<span id="20">20</span>
|
||||
<span id="21">21</span>
|
||||
<span id="22">22</span>
|
||||
<span id="23">23</span>
|
||||
<span id="24">24</span>
|
||||
<span id="25">25</span>
|
||||
<span id="26">26</span>
|
||||
<span id="27">27</span>
|
||||
<span id="28">28</span>
|
||||
<span id="29">29</span>
|
||||
<span id="30">30</span>
|
||||
<span id="31">31</span>
|
||||
<span id="32">32</span>
|
||||
<span id="33">33</span>
|
||||
<span id="34">34</span>
|
||||
<span id="35">35</span>
|
||||
<span id="36">36</span>
|
||||
<span id="37">37</span>
|
||||
<span id="38">38</span>
|
||||
<span id="39">39</span>
|
||||
<span id="40">40</span>
|
||||
<span id="41">41</span>
|
||||
<span id="42">42</span>
|
||||
<span id="43">43</span>
|
||||
<span id="44">44</span>
|
||||
<span id="45">45</span>
|
||||
<span id="46">46</span>
|
||||
<span id="47">47</span>
|
||||
<span id="48">48</span>
|
||||
<span id="49">49</span>
|
||||
<span id="50">50</span>
|
||||
<span id="51">51</span>
|
||||
<span id="52">52</span>
|
||||
<span id="53">53</span>
|
||||
<span id="54">54</span>
|
||||
<span id="55">55</span>
|
||||
<span id="56">56</span>
|
||||
<span id="57">57</span>
|
||||
<span id="58">58</span>
|
||||
<span id="59">59</span>
|
||||
<span id="60">60</span>
|
||||
<span id="61">61</span>
|
||||
<span id="62">62</span>
|
||||
<span id="63">63</span>
|
||||
<span id="64">64</span>
|
||||
<span id="65">65</span>
|
||||
<span id="66">66</span>
|
||||
<span id="67">67</span>
|
||||
<span id="68">68</span>
|
||||
<span id="69">69</span>
|
||||
<span id="70">70</span>
|
||||
<span id="71">71</span>
|
||||
<span id="72">72</span>
|
||||
<span id="73">73</span>
|
||||
<span id="74">74</span>
|
||||
<span id="75">75</span>
|
||||
<span id="76">76</span>
|
||||
<span id="77">77</span>
|
||||
<span id="78">78</span>
|
||||
<span id="79">79</span>
|
||||
<span id="80">80</span>
|
||||
<span id="81">81</span>
|
||||
<span id="82">82</span>
|
||||
<span id="83">83</span>
|
||||
<span id="84">84</span>
|
||||
<span id="85">85</span>
|
||||
<span id="86">86</span>
|
||||
<span id="87">87</span>
|
||||
<span id="88">88</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">once_cell::sync::Lazy</span>;
|
||||
<span class="kw">use</span> <span class="ident">regex::Regex</span>;
|
||||
<span class="kw">use</span> <span class="ident">serde::de</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">core::Parse</span>, <span class="ident">error::AtError</span>};
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>, <span class="ident">Hash</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">Timeout</span> {
|
||||
<span class="ident">Default</span>,
|
||||
<span class="ident">Milliseconds</span>(<span class="ident">usize</span>),
|
||||
<span class="ident">Seconds</span>(<span class="ident">usize</span>),
|
||||
}
|
||||
|
||||
<span class="kw">impl</span> <span class="ident">Parse</span> <span class="kw">for</span> <span class="ident">Timeout</span> {
|
||||
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">string</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="ident">std::result::Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">AtError</span><span class="op">></span> {
|
||||
<span class="kw">pub</span> <span class="kw">static</span> <span class="ident">FMT</span>: <span class="ident">Lazy</span><span class="op"><</span><span class="ident">Regex</span><span class="op">></span> <span class="op">=</span> <span class="ident">Lazy::new</span>(<span class="op">|</span><span class="op">|</span> {
|
||||
<span class="ident">Regex::new</span>(<span class="string">r"^\d+ (milliseconds|seconds)$"</span>).<span class="ident">expect</span>(<span class="string">"Failed to compile regex: FMT"</span>)
|
||||
});
|
||||
|
||||
<span class="kw">pub</span> <span class="kw">static</span> <span class="ident">DIGITS</span>: <span class="ident">Lazy</span><span class="op"><</span><span class="ident">Regex</span><span class="op">></span> <span class="op">=</span>
|
||||
<span class="ident">Lazy::new</span>(<span class="op">|</span><span class="op">|</span> <span class="ident">Regex::new</span>(<span class="string">r"^\d+"</span>).<span class="ident">expect</span>(<span class="string">"Failed to compile regex: DIGITS"</span>));
|
||||
|
||||
<span class="kw">pub</span> <span class="kw">static</span> <span class="ident">UNIT</span>: <span class="ident">Lazy</span><span class="op"><</span><span class="ident">Regex</span><span class="op">></span> <span class="op">=</span> <span class="ident">Lazy::new</span>(<span class="op">|</span><span class="op">|</span> {
|
||||
<span class="ident">Regex::new</span>(<span class="string">r"(milliseconds|seconds)$"</span>).<span class="ident">expect</span>(<span class="string">"Failed to compile regex: UNIT"</span>)
|
||||
});
|
||||
|
||||
<span class="macro">macro_rules!</span> <span class="ident">invalid_value</span> {
|
||||
(<span class="macro-nonterminal">$</span><span class="macro-nonterminal">got</span>:<span class="ident">expr</span>) => {
|
||||
<span class="prelude-val">Err</span>(<span class="macro">InvalidValue!</span> {
|
||||
<span class="ident">expected</span>: <span class="string">"a string of the format \"N seconds\" or \"N milliseconds\" where N is an integer > 0"</span>,
|
||||
<span class="ident">got</span>: <span class="macro-nonterminal">$</span><span class="macro-nonterminal">got</span>,
|
||||
})
|
||||
}
|
||||
}
|
||||
<span class="kw">match</span> <span class="ident">string</span> {
|
||||
<span class="string">"default"</span> => <span class="prelude-val">Ok</span>(<span class="ident">Timeout::Default</span>),
|
||||
<span class="ident">string</span> <span class="kw">if</span> <span class="op">!</span><span class="ident">FMT</span>.<span class="ident">is_match</span>(<span class="ident">string</span>) => <span class="macro">invalid_value!</span>(<span class="ident">string</span>),
|
||||
<span class="ident">string</span> => <span class="kw">match</span> (<span class="ident">DIGITS</span>.<span class="ident">find</span>(<span class="ident">string</span>), <span class="ident">UNIT</span>.<span class="ident">find</span>(<span class="ident">string</span>)) {
|
||||
(<span class="prelude-val">None</span>, <span class="kw">_</span>) => <span class="macro">invalid_value!</span>(<span class="ident">string</span>),
|
||||
(<span class="kw">_</span>, <span class="prelude-val">None</span>) => <span class="macro">invalid_value!</span>(<span class="ident">string</span>),
|
||||
(<span class="prelude-val">Some</span>(<span class="ident">dmatch</span>), <span class="prelude-val">Some</span>(<span class="ident">umatch</span>)) => {
|
||||
<span class="kw">let</span> <span class="ident">digits</span> <span class="op">=</span> <span class="kw-2">&</span><span class="ident">string</span>[<span class="ident">dmatch</span>.<span class="ident">start</span>()..<span class="ident">dmatch</span>.<span class="ident">end</span>()];
|
||||
<span class="kw">let</span> <span class="ident">unit</span> <span class="op">=</span> <span class="kw-2">&</span><span class="ident">string</span>[<span class="ident">umatch</span>.<span class="ident">start</span>()..<span class="ident">umatch</span>.<span class="ident">end</span>()];
|
||||
<span class="kw">match</span> (<span class="ident">digits</span>.<span class="ident">parse</span>(), <span class="ident">unit</span>) {
|
||||
(<span class="prelude-val">Ok</span>(<span class="ident">v</span>), <span class="string">"milliseconds"</span>) => <span class="prelude-val">Ok</span>(<span class="ident">Timeout::Milliseconds</span>(<span class="ident">v</span>)),
|
||||
(<span class="prelude-val">Ok</span>(<span class="ident">v</span>), <span class="string">"seconds"</span>) => <span class="prelude-val">Ok</span>(<span class="ident">Timeout::Seconds</span>(<span class="ident">v</span>)),
|
||||
<span class="kw">_</span> => <span class="macro">invalid_value!</span>(<span class="ident">string</span>),
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Deserialize</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">Timeout</span> {
|
||||
<span class="kw">fn</span> <span class="ident">deserialize</span><span class="op"><</span><span class="ident">D</span><span class="op">></span>(<span class="ident">deserializer</span>: <span class="ident">D</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="self">Self</span>, <span class="ident">D::Error</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">D</span>: <span class="ident">de::Deserializer</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span>,
|
||||
{
|
||||
<span class="kw">struct</span> <span class="ident">TimeoutVisitor</span>;
|
||||
|
||||
<span class="kw">impl</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="ident">de::Visitor</span><span class="op"><</span><span class="lifetime">'de</span><span class="op">></span> <span class="kw">for</span> <span class="ident">TimeoutVisitor</span> {
|
||||
<span class="kw">type</span> <span class="ident">Value</span> <span class="op">=</span> <span class="ident">Timeout</span>;
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">expecting</span>(<span class="kw-2">&</span><span class="self">self</span>, <span class="ident">formatter</span>: <span class="kw-2">&mut</span> <span class="ident">fmt::Formatter</span>) -> <span class="ident">fmt::Result</span> {
|
||||
<span class="kw">let</span> <span class="ident">msg</span> <span class="op">=</span> <span class="string">"Either \"default\", \"disabled\", \"os\", or a string of the format \"N seconds\" where N is an integer > 0"</span>;
|
||||
<span class="ident">formatter</span>.<span class="ident">write_str</span>(<span class="ident">msg</span>)
|
||||
}
|
||||
|
||||
<span class="kw">fn</span> <span class="ident">visit_str</span><span class="op"><</span><span class="ident">E</span><span class="op">></span>(<span class="self">self</span>, <span class="ident">value</span>: <span class="kw-2">&</span><span class="ident">str</span>) -> <span class="prelude-ty">Result</span><span class="op"><</span><span class="ident"><span class="self">Self</span>::Value</span>, <span class="ident">E</span><span class="op">></span>
|
||||
<span class="kw">where</span>
|
||||
<span class="ident">E</span>: <span class="ident">de::Error</span>,
|
||||
{
|
||||
<span class="kw">match</span> <span class="ident">Timeout::parse</span>(<span class="ident">value</span>) {
|
||||
<span class="prelude-val">Ok</span>(<span class="ident">num_workers</span>) => <span class="prelude-val">Ok</span>(<span class="ident">num_workers</span>),
|
||||
<span class="prelude-val">Err</span>(<span class="ident">AtError::InvalidValue</span> { <span class="ident">expected</span>, <span class="ident">got</span>, .. }) => <span class="prelude-val">Err</span>(
|
||||
<span class="ident">de::Error::invalid_value</span>(<span class="ident">de::Unexpected::Str</span>(<span class="kw-2">&</span><span class="ident">got</span>), <span class="kw-2">&</span><span class="ident">expected</span>),
|
||||
),
|
||||
<span class="prelude-val">Err</span>(<span class="kw">_</span>) => <span class="macro">unreachable!</span>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<span class="ident">deserializer</span>.<span class="ident">deserialize_string</span>(<span class="ident">TimeoutVisitor</span>)
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_settings" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (0f4bcadb4 2022-07-30)" ></div></body></html>
|
24
src/actix_settings/actix/tls.rs.html
Normal file
24
src/actix_settings/actix/tls.rs.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!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-settings/src/actix/tls.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>tls.rs - source</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Regular.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../FiraSans-Medium.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Regular.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceSerif4-Bold.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../SourceCodePro-Semibold.ttf.woff2"><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="../../../ayu.css" disabled><link rel="stylesheet" type="text/css" href="../../../dark.css" disabled><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script id="default-settings" ></script><script src="../../../storage.js"></script><script defer src="../../../source-script.js"></script><script defer src="../../../source-files.js"></script><script defer src="../../../main.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"></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="mobile-topbar"><button class="sidebar-menu-toggle">☰</button><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="../../../actix_settings/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div></a></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../actix_settings/index.html"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></a><nav class="sub"><form class="search-form"><div class="search-container"><span></span><input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><button type="button">?</button></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../wheel.svg"></a></div></div></form></nav></div><section id="main-content" 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>
|
||||
<span id="5">5</span>
|
||||
<span id="6">6</span>
|
||||
<span id="7">7</span>
|
||||
<span id="8">8</span>
|
||||
<span id="9">9</span>
|
||||
<span id="10">10</span>
|
||||
<span id="11">11</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::path::PathBuf</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">serde::Deserialize</span>;
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>, <span class="ident">Hash</span>, <span class="ident">Deserialize</span>)]</span>
|
||||
<span class="attribute">#[<span class="ident">serde</span>(<span class="ident">rename_all</span> <span class="op">=</span> <span class="string">"kebab-case"</span>)]</span>
|
||||
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">Tls</span> {
|
||||
<span class="kw">pub</span> <span class="ident">enabled</span>: <span class="ident">bool</span>,
|
||||
<span class="kw">pub</span> <span class="ident">certificate</span>: <span class="ident">PathBuf</span>,
|
||||
<span class="kw">pub</span> <span class="ident">private_key</span>: <span class="ident">PathBuf</span>,
|
||||
}
|
||||
</code></pre></div>
|
||||
</section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="actix_settings" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (0f4bcadb4 2022-07-30)" ></div></body></html>
|
@@ -694,16 +694,8 @@
|
||||
<span id="694">694</span>
|
||||
<span id="695">695</span>
|
||||
<span id="696">696</span>
|
||||
<span id="697">697</span>
|
||||
<span id="698">698</span>
|
||||
<span id="699">699</span>
|
||||
<span id="700">700</span>
|
||||
<span id="701">701</span>
|
||||
<span id="702">702</span>
|
||||
<span id="703">703</span>
|
||||
<span id="704">704</span>
|
||||
<span id="705">705</span>
|
||||
</pre><pre class="rust"><code><span class="doccomment">/// A library to process Server.toml files</span>
|
||||
</pre><pre class="rust"><code><span class="doccomment">//! Easily manage Actix Web's settings from a TOML file and environment variables.</span>
|
||||
|
||||
<span class="kw">use</span> <span class="ident">std</span>::{
|
||||
<span class="ident">env</span>, <span class="ident">fmt</span>,
|
||||
<span class="ident">fs::File</span>,
|
||||
@@ -727,7 +719,10 @@
|
||||
<span class="kw">mod</span> <span class="ident">actix</span>;
|
||||
<span class="kw">mod</span> <span class="ident">core</span>;
|
||||
|
||||
<span class="kw">pub</span> <span class="kw">use</span> <span class="ident"><span class="self">self</span>::actix</span>::<span class="kw-2">*</span>;
|
||||
<span class="kw">pub</span> <span class="kw">use</span> <span class="ident"><span class="self">self</span>::actix</span>::{
|
||||
<span class="ident">ActixSettings</span>, <span class="ident">Address</span>, <span class="ident">Backlog</span>, <span class="ident">KeepAlive</span>, <span class="ident">MaxConnectionRate</span>, <span class="ident">MaxConnections</span>, <span class="ident">Mode</span>,
|
||||
<span class="ident">NumWorkers</span>, <span class="ident">Timeout</span>, <span class="ident">Tls</span>,
|
||||
};
|
||||
<span class="kw">pub</span> <span class="kw">use</span> <span class="ident"><span class="self">self</span>::core::Parse</span>;
|
||||
<span class="kw">pub</span> <span class="kw">use</span> <span class="ident"><span class="self">self</span>::error</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>};
|
||||
|
||||
@@ -919,25 +914,18 @@
|
||||
|
||||
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
|
||||
<span class="kw">mod</span> <span class="ident">tests</span> {
|
||||
<span class="attribute">#![<span class="ident">allow</span>(<span class="ident">non_snake_case</span>)]</span>
|
||||
<span class="kw">use</span> <span class="ident">actix_web::App</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">std::path::Path</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident">actix_web</span>::{<span class="ident">App</span>, <span class="ident">HttpServer</span>};
|
||||
<span class="kw">use</span> <span class="ident">serde::Deserialize</span>;
|
||||
|
||||
<span class="kw">use</span> <span class="ident"><span class="kw">crate</span>::actix</span>::<span class="kw-2">*</span>; <span class="comment">// used for value construction in assertions</span>
|
||||
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">ApplySettings</span>, <span class="ident">AtResult</span>, <span class="ident">BasicSettings</span>, <span class="ident">Settings</span>};
|
||||
<span class="kw">use</span> <span class="kw">super</span>::<span class="kw-2">*</span>;
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">apply_settings</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::parse_toml</span>(<span class="string">"Server.toml"</span>)<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">apply_settings</span>() {
|
||||
<span class="kw">let</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::parse_toml</span>(<span class="string">"Server.toml"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="kw">let</span> <span class="kw">_</span> <span class="op">=</span> <span class="ident">HttpServer::new</span>(<span class="ident">App::new</span>).<span class="ident">apply_settings</span>(<span class="kw-2">&</span><span class="ident">settings</span>);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__hosts</span>() {
|
||||
<span class="kw">fn</span> <span class="ident">override_field_hosts</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
@@ -973,7 +961,7 @@
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__hosts</span>() {
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_hosts</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
@@ -1011,149 +999,141 @@
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__mode</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_mode</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">mode</span>, <span class="ident">Mode::Development</span>);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">mode</span>, <span class="string">"production"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">mode</span>, <span class="string">"production"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">mode</span>, <span class="ident">Mode::Production</span>);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__mode</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_mode</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">mode</span>, <span class="ident">Mode::Development</span>);
|
||||
<span class="ident">std::env::set_var</span>(<span class="string">"OVERRIDE__MODE"</span>, <span class="string">"production"</span>);
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">mode</span>, <span class="string">"OVERRIDE__MODE"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">mode</span>, <span class="string">"OVERRIDE__MODE"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">mode</span>, <span class="ident">Mode::Production</span>);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__enable_compression</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_enable_compression</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_compression</span>);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_compression</span>, <span class="string">"false"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_compression</span>, <span class="string">"false"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_compression</span>);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__enable_compression</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_enable_compression</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_compression</span>);
|
||||
<span class="ident">std::env::set_var</span>(<span class="string">"OVERRIDE__ENABLE_COMPRESSION"</span>, <span class="string">"false"</span>);
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_compression</span>,
|
||||
<span class="string">"OVERRIDE__ENABLE_COMPRESSION"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_compression</span>);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__enable_log</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_enable_log</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_log</span>);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_log</span>, <span class="string">"false"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_log</span>, <span class="string">"false"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_log</span>);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__enable_log</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_enable_log</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_log</span>);
|
||||
<span class="ident">std::env::set_var</span>(<span class="string">"OVERRIDE__ENABLE_LOG"</span>, <span class="string">"false"</span>);
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_log</span>,
|
||||
<span class="string">"OVERRIDE__ENABLE_LOG"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_log</span>);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__num_workers</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_num_workers</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">num_workers</span>, <span class="ident">NumWorkers::Default</span>);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">num_workers</span>, <span class="string">"42"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">num_workers</span>, <span class="string">"42"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">num_workers</span>, <span class="ident">NumWorkers::Manual</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__num_workers</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_num_workers</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">num_workers</span>, <span class="ident">NumWorkers::Default</span>);
|
||||
<span class="ident">std::env::set_var</span>(<span class="string">"OVERRIDE__NUM_WORKERS"</span>, <span class="string">"42"</span>);
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">num_workers</span>,
|
||||
<span class="string">"OVERRIDE__NUM_WORKERS"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">num_workers</span>, <span class="ident">NumWorkers::Manual</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__backlog</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_backlog</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">backlog</span>, <span class="ident">Backlog::Default</span>);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">backlog</span>, <span class="string">"42"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">backlog</span>, <span class="string">"42"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">backlog</span>, <span class="ident">Backlog::Manual</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__backlog</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_backlog</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">backlog</span>, <span class="ident">Backlog::Default</span>);
|
||||
<span class="ident">std::env::set_var</span>(<span class="string">"OVERRIDE__BACKLOG"</span>, <span class="string">"42"</span>);
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">backlog</span>, <span class="string">"OVERRIDE__BACKLOG"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">backlog</span>, <span class="string">"OVERRIDE__BACKLOG"</span>)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">backlog</span>, <span class="ident">Backlog::Manual</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__max_connections</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_max_connections</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connections</span>, <span class="ident">MaxConnections::Default</span>);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connections</span>, <span class="string">"42"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connections</span>, <span class="string">"42"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connections</span>, <span class="ident">MaxConnections::Manual</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__max_connections</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_max_connections</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connections</span>, <span class="ident">MaxConnections::Default</span>);
|
||||
<span class="ident">std::env::set_var</span>(<span class="string">"OVERRIDE__MAX_CONNECTIONS"</span>, <span class="string">"42"</span>);
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connections</span>,
|
||||
<span class="string">"OVERRIDE__MAX_CONNECTIONS"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connections</span>, <span class="ident">MaxConnections::Manual</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__max_connection_rate</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_max_connection_rate</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connection_rate</span>,
|
||||
<span class="ident">MaxConnectionRate::Default</span>
|
||||
);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connection_rate</span>, <span class="string">"42"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connection_rate</span>, <span class="string">"42"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connection_rate</span>,
|
||||
<span class="ident">MaxConnectionRate::Manual</span>(<span class="number">42</span>)
|
||||
);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__max_connection_rate</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_max_connection_rate</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connection_rate</span>,
|
||||
<span class="ident">MaxConnectionRate::Default</span>
|
||||
@@ -1162,127 +1142,122 @@
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connection_rate</span>,
|
||||
<span class="string">"OVERRIDE__MAX_CONNECTION_RATE"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">max_connection_rate</span>,
|
||||
<span class="ident">MaxConnectionRate::Manual</span>(<span class="number">42</span>)
|
||||
);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__keep_alive</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_keep_alive</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">keep_alive</span>, <span class="ident">KeepAlive::Default</span>);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">keep_alive</span>, <span class="string">"42 seconds"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">keep_alive</span>, <span class="string">"42 seconds"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">keep_alive</span>, <span class="ident">KeepAlive::Seconds</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__keep_alive</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_keep_alive</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">keep_alive</span>, <span class="ident">KeepAlive::Default</span>);
|
||||
<span class="ident">std::env::set_var</span>(<span class="string">"OVERRIDE__KEEP_ALIVE"</span>, <span class="string">"42 seconds"</span>);
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">keep_alive</span>,
|
||||
<span class="string">"OVERRIDE__KEEP_ALIVE"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">keep_alive</span>, <span class="ident">KeepAlive::Seconds</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__client_timeout</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_client_timeout</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_timeout</span>, <span class="ident">Timeout::Default</span>);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_timeout</span>, <span class="string">"42 seconds"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_timeout</span>, <span class="string">"42 seconds"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_timeout</span>, <span class="ident">Timeout::Seconds</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__client_timeout</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_client_timeout</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_timeout</span>, <span class="ident">Timeout::Default</span>);
|
||||
<span class="ident">std::env::set_var</span>(<span class="string">"OVERRIDE__CLIENT_TIMEOUT"</span>, <span class="string">"42 seconds"</span>);
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_timeout</span>,
|
||||
<span class="string">"OVERRIDE__CLIENT_TIMEOUT"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_timeout</span>, <span class="ident">Timeout::Seconds</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__client_shutdown</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_client_shutdown</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_shutdown</span>, <span class="ident">Timeout::Default</span>);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_shutdown</span>, <span class="string">"42 seconds"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_shutdown</span>, <span class="string">"42 seconds"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_shutdown</span>, <span class="ident">Timeout::Seconds</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__client_shutdown</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_client_shutdown</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_shutdown</span>, <span class="ident">Timeout::Default</span>);
|
||||
<span class="ident">std::env::set_var</span>(<span class="string">"OVERRIDE__CLIENT_SHUTDOWN"</span>, <span class="string">"42 seconds"</span>);
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_shutdown</span>,
|
||||
<span class="string">"OVERRIDE__CLIENT_SHUTDOWN"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_shutdown</span>, <span class="ident">Timeout::Seconds</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__shutdown_timeout</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_shutdown_timeout</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">shutdown_timeout</span>, <span class="ident">Timeout::Default</span>);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">shutdown_timeout</span>, <span class="string">"42 seconds"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">shutdown_timeout</span>, <span class="string">"42 seconds"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">shutdown_timeout</span>, <span class="ident">Timeout::Seconds</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__shutdown_timeout</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_shutdown_timeout</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">shutdown_timeout</span>, <span class="ident">Timeout::Default</span>);
|
||||
<span class="ident">std::env::set_var</span>(<span class="string">"OVERRIDE__SHUTDOWN_TIMEOUT"</span>, <span class="string">"42 seconds"</span>);
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">shutdown_timeout</span>,
|
||||
<span class="string">"OVERRIDE__SHUTDOWN_TIMEOUT"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">shutdown_timeout</span>, <span class="ident">Timeout::Seconds</span>(<span class="number">42</span>));
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__tls__enabled</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_tls_enabled</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">enabled</span>);
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">enabled</span>, <span class="string">"true"</span>)<span class="question-mark">?</span>;
|
||||
<span class="ident">Settings::override_field</span>(<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">enabled</span>, <span class="string">"true"</span>).<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">enabled</span>);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__tls__enabled</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_tls_enabled</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="op">!</span><span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">enabled</span>);
|
||||
<span class="ident">std::env::set_var</span>(<span class="string">"OVERRIDE__TLS_ENABLED"</span>, <span class="string">"true"</span>);
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">enabled</span>,
|
||||
<span class="string">"OVERRIDE__TLS_ENABLED"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert!</span>(<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">enabled</span>);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__tls__certificate</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_tls_certificate</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">certificate</span>,
|
||||
<span class="ident">Path::new</span>(<span class="string">"path/to/cert/cert.pem"</span>)
|
||||
@@ -1290,17 +1265,17 @@
|
||||
<span class="ident">Settings::override_field</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">certificate</span>,
|
||||
<span class="string">"/overridden/path/to/cert/cert.pem"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">certificate</span>,
|
||||
<span class="ident">Path::new</span>(<span class="string">"/overridden/path/to/cert/cert.pem"</span>)
|
||||
);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__tls__certificate</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_tls_certificate</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">certificate</span>,
|
||||
<span class="ident">Path::new</span>(<span class="string">"path/to/cert/cert.pem"</span>)
|
||||
@@ -1312,17 +1287,17 @@
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">certificate</span>,
|
||||
<span class="string">"OVERRIDE__TLS_CERTIFICATE"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">certificate</span>,
|
||||
<span class="ident">Path::new</span>(<span class="string">"/overridden/path/to/cert/cert.pem"</span>)
|
||||
);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field__tls__private_key</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_tls_private_key</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">private_key</span>,
|
||||
<span class="ident">Path::new</span>(<span class="string">"path/to/cert/key.pem"</span>)
|
||||
@@ -1330,17 +1305,17 @@
|
||||
<span class="ident">Settings::override_field</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">private_key</span>,
|
||||
<span class="string">"/overridden/path/to/cert/key.pem"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">private_key</span>,
|
||||
<span class="ident">Path::new</span>(<span class="string">"/overridden/path/to/cert/key.pem"</span>)
|
||||
);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var__tls__private_key</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>()<span class="question-mark">?</span>;
|
||||
<span class="kw">fn</span> <span class="ident">override_field_with_env_var_tls_private_key</span>() {
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">Settings::from_default_template</span>().<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">private_key</span>,
|
||||
<span class="ident">Path::new</span>(<span class="string">"path/to/cert/key.pem"</span>)
|
||||
@@ -1352,35 +1327,40 @@
|
||||
<span class="ident">Settings::override_field_with_env_var</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">private_key</span>,
|
||||
<span class="string">"OVERRIDE__TLS_PRIVATE_KEY"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">tls</span>.<span class="ident">private_key</span>,
|
||||
<span class="ident">Path::new</span>(<span class="string">"/overridden/path/to/cert/key.pem"</span>)
|
||||
);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
|
||||
<span class="attribute">#[<span class="ident">test</span>]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_extended_field_with_custom_type</span>() -> <span class="ident">AtResult</span><span class="op"><</span>()<span class="op">></span> {
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">Deserialize</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>)]</span>
|
||||
<span class="kw">fn</span> <span class="ident">override_extended_field_with_custom_type</span>() {
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>, <span class="ident">Deserialize</span>)]</span>
|
||||
<span class="kw">struct</span> <span class="ident">NestedSetting</span> {
|
||||
<span class="ident">foo</span>: <span class="ident">String</span>,
|
||||
<span class="ident">bar</span>: <span class="ident">bool</span>,
|
||||
}
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">Deserialize</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>)]</span>
|
||||
|
||||
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>, <span class="ident">PartialEq</span>, <span class="ident">Eq</span>, <span class="ident">Deserialize</span>)]</span>
|
||||
<span class="kw">struct</span> <span class="ident">AppSettings</span> {
|
||||
<span class="attribute">#[<span class="ident">serde</span>(<span class="ident">rename</span> <span class="op">=</span> <span class="string">"example-name"</span>)]</span>
|
||||
<span class="ident">example_name</span>: <span class="ident">String</span>,
|
||||
<span class="attribute">#[<span class="ident">serde</span>(<span class="ident">rename</span> <span class="op">=</span> <span class="string">"nested-field"</span>)]</span>
|
||||
<span class="ident">nested_field</span>: <span class="ident">NestedSetting</span>,
|
||||
}
|
||||
|
||||
<span class="kw">type</span> <span class="ident">CustomSettings</span> <span class="op">=</span> <span class="ident">BasicSettings</span><span class="op"><</span><span class="ident">AppSettings</span><span class="op">></span>;
|
||||
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">CustomSettings::from_template</span>(
|
||||
<span class="kw-2">&</span>(<span class="ident">CustomSettings::DEFAULT_TOML_TEMPLATE</span>.<span class="ident">to_string</span>()
|
||||
<span class="comment">// NOTE: Add these entries to the `[application]` table:</span>
|
||||
<span class="op">+</span> <span class="string">"\nexample-name = \"example value\""</span>
|
||||
<span class="op">+</span> <span class="string">"\nnested-field = { foo = \"foo\", bar = false }"</span>),
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">application</span>,
|
||||
<span class="ident">AppSettings</span> {
|
||||
@@ -1391,10 +1371,13 @@
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
<span class="ident">CustomSettings::override_field</span>(
|
||||
<span class="kw-2">&mut</span> <span class="ident">settings</span>.<span class="ident">application</span>.<span class="ident">example_name</span>,
|
||||
<span class="string">"/overridden/path/to/cert/key.pem"</span>,
|
||||
)<span class="question-mark">?</span>;
|
||||
)
|
||||
.<span class="ident">unwrap</span>();
|
||||
|
||||
<span class="macro">assert_eq!</span>(
|
||||
<span class="ident">settings</span>.<span class="ident">application</span>,
|
||||
<span class="ident">AppSettings</span> {
|
||||
@@ -1405,7 +1388,6 @@
|
||||
},
|
||||
}
|
||||
);
|
||||
<span class="prelude-val">Ok</span>(())
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
|
Reference in New Issue
Block a user