1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 01:32:57 +01:00

Deploying to gh-pages from @ b054733854 🚀

This commit is contained in:
robjtede 2022-07-31 19:14:56 +00:00
parent c938b4bd37
commit dd622cd699
34 changed files with 771 additions and 161 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,70 @@
<!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="Easily manage Actix Webs settings from a TOML file and environment variables."><meta name="keywords" content="rust, rustlang, rust-lang, actix_settings"><title>actix_settings - Rust</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="../crates.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../actix_settings/index.html"><div class="logo-container"><img src="https://actix.rs/img/logo.png" 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"> <!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="Easily manage Actix Webs settings from a TOML file and environment variables."><meta name="keywords" content="rust, rustlang, rust-lang, actix_settings"><title>actix_settings - Rust</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="../crates.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../actix_settings/index.html"><div class="logo-container"><img src="https://actix.rs/img/logo.png" 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 src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2 class="location"><a href="#">Crate actix_settings</a></h2><div class="sidebar-elems"><div class="block"><ul><li class="version">Version 0.5.2</li><li><a id="all-types" href="all.html">All Items</a></li></ul></div><section><div class="block"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#types">Type Definitions</a></li></ul></div></section></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../actix_settings/index.html"> <img src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2 class="location"><a href="#">Crate actix_settings</a></h2><div class="sidebar-elems"><div class="block"><ul><li class="version">Version 0.5.2</li><li><a id="all-types" href="all.html">All Items</a></li></ul></div><section><div class="block"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li><li><a href="#traits">Traits</a></li><li><a href="#types">Type Definitions</a></li></ul></div></section></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../actix_settings/index.html">
<img src="https://actix.rs/img/logo.png" 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="main-heading"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">actix_settings</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/actix_settings/lib.rs.html#1-702">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Easily manage Actix Webs settings from a TOML file and environment variables.</p> <img src="https://actix.rs/img/logo.png" 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="main-heading"><h1 class="fqn"><span class="in-band">Crate <a class="mod" href="#">actix_settings</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/actix_settings/lib.rs.html#1-805">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Easily manage Actix Webs settings from a TOML file and environment variables.</p>
<p>To get started add a <a href="struct.BasicSettings.html#method.parse_toml"><code>Settings::parse_toml(&quot;./Server.toml&quot;)</code></a> call to the
top of your main function. This will create a template file with descriptions of all the
configurable settings. You can change or remove anything in that file and it will be picked up
the next time you run your application.</p>
<p>Overriding parts of the file can be done from values using <a href="struct.BasicSettings.html#method.override_field" title="Settings::override_field"><code>Settings::override_field</code></a> or from
the environment using <a href="struct.BasicSettings.html#method.override_field_with_env_var" title="Settings::override_field_with_env_var"><code>Settings::override_field_with_env_var</code></a>.</p>
<h2 id="examples"><a href="#examples">Examples</a></h2>
<p>See examples folder on GitHub for complete example.</p>
<div class='information'><div class='tooltip ignore'></div></div><div class="example-wrap"><pre class="rust rust-example-rendered ignore"><code><span class="kw">use</span> <span class="ident">actix_settings</span>::{<span class="ident">ApplySettings</span> <span class="kw">as</span> <span class="kw">_</span>, <span class="ident">Mode</span>, <span class="ident">Settings</span>};
<span class="attribute">#[<span class="ident">actix_web::main</span>]</span>
<span class="kw">async</span> <span class="kw">fn</span> <span class="ident">main</span>() -&gt; <span class="ident">std::io::Result</span><span class="op">&lt;</span>()<span class="op">&gt;</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::parse_toml</span>(<span class="string">&quot;./Server.toml&quot;</span>)
.<span class="ident">expect</span>(<span class="string">&quot;Failed to parse `Settings` from Server.toml&quot;</span>);
<span class="comment">// If the environment variable `$APPLICATION__HOSTS` is set,</span>
<span class="comment">// have its value override the `settings.actix.hosts` setting:</span>
<span class="ident">Settings::override_field_with_env_var</span>(<span class="kw-2">&amp;mut</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">hosts</span>, <span class="string">&quot;APPLICATION__HOSTS&quot;</span>)<span class="question-mark">?</span>;
<span class="ident">init_logger</span>(<span class="kw-2">&amp;</span><span class="ident">settings</span>);
<span class="ident">HttpServer::new</span>({
<span class="comment">// clone settings into each worker thread</span>
<span class="kw">let</span> <span class="ident">settings</span> <span class="op">=</span> <span class="ident">settings</span>.<span class="ident">clone</span>();
<span class="kw">move</span> <span class="op">|</span><span class="op">|</span> {
<span class="ident">App::new</span>()
<span class="comment">// Include this `.wrap()` call for compression settings to take effect</span>
.<span class="ident">wrap</span>(<span class="ident">Condition::new</span>(
<span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">enable_compression</span>,
<span class="ident">Compress::default</span>(),
))
<span class="comment">// add request logger</span>
.<span class="ident">wrap</span>(<span class="ident">Logger::default</span>())
<span class="comment">// make `Settings` available to handlers</span>
.<span class="ident">app_data</span>(<span class="ident">web::Data::new</span>(<span class="ident">settings</span>.<span class="ident">clone</span>()))
<span class="comment">// add request handlers as normal</span>
.<span class="ident">service</span>(<span class="ident">index</span>)
}
})
<span class="comment">// apply the `Settings` to Actix Web&#39;s `HttpServer`</span>
.<span class="ident">apply_settings</span>(<span class="kw-2">&amp;</span><span class="ident">settings</span>)
.<span class="ident">run</span>()
.<span class="kw">await</span>
}</code></pre></div>
</div></details><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ActixSettings.html" title="actix_settings::ActixSettings struct">ActixSettings</a></div><div class="item-right docblock-short"><p>Settings types for Actix Web.</p> </div></details><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ActixSettings.html" title="actix_settings::ActixSettings struct">ActixSettings</a></div><div class="item-right docblock-short"><p>Settings types for Actix Web.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Address.html" title="actix_settings::Address struct">Address</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.BasicSettings.html" title="actix_settings::BasicSettings struct">BasicSettings</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.NoSettings.html" title="actix_settings::NoSettings struct">NoSettings</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Tls.html" title="actix_settings::Tls struct">Tls</a></div><div class="item-right docblock-short"></div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.AtError.html" title="actix_settings::AtError enum">AtError</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Backlog.html" title="actix_settings::Backlog enum">Backlog</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.KeepAlive.html" title="actix_settings::KeepAlive enum">KeepAlive</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.MaxConnectionRate.html" title="actix_settings::MaxConnectionRate enum">MaxConnectionRate</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.MaxConnections.html" title="actix_settings::MaxConnections enum">MaxConnections</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Mode.html" title="actix_settings::Mode enum">Mode</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.NumWorkers.html" title="actix_settings::NumWorkers enum">NumWorkers</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Timeout.html" title="actix_settings::Timeout enum">Timeout</a></div><div class="item-right docblock-short"></div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.ApplySettings.html" title="actix_settings::ApplySettings trait">ApplySettings</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Parse.html" title="actix_settings::Parse trait">Parse</a></div><div class="item-right docblock-short"></div></div></div><h2 id="types" class="small-section-header"><a href="#types">Type Definitions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="type" href="type.AtResult.html" title="actix_settings::AtResult type">AtResult</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="type" href="type.Settings.html" title="actix_settings::Settings type">Settings</a></div><div class="item-right docblock-short"></div></div></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> </div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Address.html" title="actix_settings::Address struct">Address</a></div><div class="item-right docblock-short"><p>A host/port pair for the server to bind to.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.BasicSettings.html" title="actix_settings::BasicSettings struct">BasicSettings</a></div><div class="item-right docblock-short"><p>Wrapper for server and application-specific settings.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.NoSettings.html" title="actix_settings::NoSettings struct">NoSettings</a></div><div class="item-right docblock-short"><p>Marker type representing no defined application-specific settings.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.Tls.html" title="actix_settings::Tls struct">Tls</a></div><div class="item-right docblock-short"><p>TLS (HTTPS) configuration.</p>
</div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.AtError.html" title="actix_settings::AtError enum">AtError</a></div><div class="item-right docblock-short"><p>Errors that can be returned from methods in this crate.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Backlog.html" title="actix_settings::Backlog enum">Backlog</a></div><div class="item-right docblock-short"><p>The maximum number of pending connections.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.KeepAlive.html" title="actix_settings::KeepAlive enum">KeepAlive</a></div><div class="item-right docblock-short"><p>The server keep-alive preference.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.MaxConnectionRate.html" title="actix_settings::MaxConnectionRate enum">MaxConnectionRate</a></div><div class="item-right docblock-short"><p>The maximum per-worker concurrent TLS connection limit.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.MaxConnections.html" title="actix_settings::MaxConnections enum">MaxConnections</a></div><div class="item-right docblock-short"><p>The maximum per-worker number of concurrent connections.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Mode.html" title="actix_settings::Mode enum">Mode</a></div><div class="item-right docblock-short"><p>Marker of intended deployment environment.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.NumWorkers.html" title="actix_settings::NumWorkers enum">NumWorkers</a></div><div class="item-right docblock-short"><p>The number of workers that the server should start.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.Timeout.html" title="actix_settings::Timeout enum">Timeout</a></div><div class="item-right docblock-short"><p>A timeout duration in milliseconds or seconds.</p>
</div></div></div><h2 id="traits" class="small-section-header"><a href="#traits">Traits</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.ApplySettings.html" title="actix_settings::ApplySettings trait">ApplySettings</a></div><div class="item-right docblock-short"><p>Extension trait for applying parsed settings to the server object.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="trait" href="trait.Parse.html" title="actix_settings::Parse trait">Parse</a></div><div class="item-right docblock-short"><p>A specialized <code>FromStr</code> trait that returns <a href="enum.AtError.html" title="AtError"><code>AtError</code></a> errors</p>
</div></div></div><h2 id="types" class="small-section-header"><a href="#types">Type Definitions</a></h2><div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="type" href="type.AtResult.html" title="actix_settings::AtResult type">AtResult</a></div><div class="item-right docblock-short"><p>Convenience type alias for <code>Result&lt;T, AtError&gt;</code>.</p>
</div></div><div class="item-row"><div class="item-left module-item"><a class="type" href="type.Settings.html" title="actix_settings::Settings type">Settings</a></div><div class="item-right docblock-short"><p>Convenience type alias for <a href="struct.BasicSettings.html" title="BasicSettings"><code>BasicSettings</code></a> with no defined application-specific settings.</p>
</div></div></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>

View File

@ -1 +1 @@
window.SIDEBAR_ITEMS = {"enum":[["AtError",""],["Backlog",""],["KeepAlive",""],["MaxConnectionRate",""],["MaxConnections",""],["Mode",""],["NumWorkers",""],["Timeout",""]],"struct":[["ActixSettings","Settings types for Actix Web."],["Address",""],["BasicSettings",""],["NoSettings",""],["Tls",""]],"trait":[["ApplySettings",""],["Parse",""]],"type":[["AtResult",""],["Settings",""]]}; window.SIDEBAR_ITEMS = {"enum":[["AtError","Errors that can be returned from methods in this crate."],["Backlog","The maximum number of pending connections."],["KeepAlive","The server keep-alive preference."],["MaxConnectionRate","The maximum per-worker concurrent TLS connection limit."],["MaxConnections","The maximum per-worker number of concurrent connections."],["Mode","Marker of intended deployment environment."],["NumWorkers","The number of workers that the server should start."],["Timeout","A timeout duration in milliseconds or seconds."]],"struct":[["ActixSettings","Settings types for Actix Web."],["Address","A host/port pair for the server to bind to."],["BasicSettings","Wrapper for server and application-specific settings."],["NoSettings","Marker type representing no defined application-specific settings."],["Tls","TLS (HTTPS) configuration."]],"trait":[["ApplySettings","Extension trait for applying parsed settings to the server object."],["Parse","A specialized `FromStr` trait that returns [`AtError`] errors"]],"type":[["AtResult","Convenience type alias for `Result<T, AtError>`."],["Settings","Convenience type alias for [`BasicSettings`] with no defined application-specific settings."]]};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,7 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `ApplySettings` trait in crate `actix_settings`."><meta name="keywords" content="rust, rustlang, rust-lang, ApplySettings"><title>ApplySettings in actix_settings - Rust</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="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../actix_settings/index.html"><div class="logo-container"><img src="https://actix.rs/img/logo.png" 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"> <!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="Extension trait for applying parsed settings to the server object."><meta name="keywords" content="rust, rustlang, rust-lang, ApplySettings"><title>ApplySettings in actix_settings - Rust</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="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="../actix_settings/index.html"><div class="logo-container"><img src="https://actix.rs/img/logo.png" 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 src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2 class="location"><a href="#">ApplySettings</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#required-methods">Required Methods</a></h3><ul><li><a href="#tymethod.apply_settings">apply_settings</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul><li><a href="#impl-ApplySettings-for-HttpServer%3CF%2C%20I%2C%20S%2C%20B%3E">HttpServer&lt;F, I, S, B&gt;</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In actix_settings</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../actix_settings/index.html"> <img src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2 class="location"><a href="#">ApplySettings</a></h2><div class="sidebar-elems"><section><div class="block"><h3 class="sidebar-title"><a href="#required-methods">Required Methods</a></h3><ul><li><a href="#tymethod.apply_settings">apply_settings</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul><li><a href="#impl-ApplySettings-for-HttpServer%3CF%2C%20I%2C%20S%2C%20B%3E">HttpServer&lt;F, I, S, B&gt;</a></li></ul></div><div class="block"><h3 class="sidebar-title"><a href="#implementors">Implementors</a></h3></div></section><h2 class="location"><a href="index.html">In actix_settings</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../actix_settings/index.html">
<img src="https://actix.rs/img/logo.png" 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="main-heading"><h1 class="fqn"><span class="in-band">Trait <a href="index.html">actix_settings</a>::<wbr><a class="trait" href="#">ApplySettings</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/actix_settings/lib.rs.html#135-143">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="docblock item-decl"><pre class="rust trait"><code>pub trait ApplySettings { <img src="https://actix.rs/img/logo.png" 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="main-heading"><h1 class="fqn"><span class="in-band">Trait <a href="index.html">actix_settings</a>::<wbr><a class="trait" href="#">ApplySettings</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/actix_settings/lib.rs.html#238-246">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="docblock item-decl"><pre class="rust trait"><code>pub trait ApplySettings {
fn <a href="#tymethod.apply_settings" class="fnname">apply_settings</a>&lt;A&gt;(self, settings: &amp;<a class="struct" href="struct.BasicSettings.html" title="struct actix_settings::BasicSettings">BasicSettings</a>&lt;A&gt;) -&gt; Self<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="https://docs.rs/serde/1.0.140/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a></span>; fn <a href="#tymethod.apply_settings" class="fnname">apply_settings</a>&lt;A&gt;(self, settings: &amp;<a class="struct" href="struct.BasicSettings.html" title="struct actix_settings::BasicSettings">BasicSettings</a>&lt;A&gt;) -&gt; Self<br>&nbsp;&nbsp;&nbsp; <span class="where">where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="https://docs.rs/serde/1.0.140/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a></span>;
}</code></pre></div><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.apply_settings" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_settings/lib.rs.html#140-142">source</a></div><h4 class="code-header">fn <a href="#tymethod.apply_settings" class="fnname">apply_settings</a>&lt;A&gt;(self, settings: &amp;<a class="struct" href="struct.BasicSettings.html" title="struct actix_settings::BasicSettings">BasicSettings</a>&lt;A&gt;) -&gt; Self <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="https://docs.rs/serde/1.0.140/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>,&nbsp;</span></h4></div></summary><div class="docblock"><p>Apply a <a href="./struct.BasicSettings.html"><code>BasicSettings</code></a> value to <code>self</code>.</p> }</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Extension trait for applying parsed settings to the server object.</p>
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ApplySettings-for-HttpServer%3CF%2C%20I%2C%20S%2C%20B%3E" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/actix_settings/lib.rs.html#145-224">source</a></span><a href="#impl-ApplySettings-for-HttpServer%3CF%2C%20I%2C%20S%2C%20B%3E" class="anchor"></a><h3 class="code-header in-band">impl&lt;F, I, S, B&gt; <a class="trait" href="trait.ApplySettings.html" title="trait actix_settings::ApplySettings">ApplySettings</a> for HttpServer&lt;F, I, S, B&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>() -&gt; I + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: IntoServiceFactory&lt;S, Request&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;S: ServiceFactory&lt;Request, Config = AppConfig&gt; + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;S::Error: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;WebError&gt; + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;S::InitError: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;S::Response: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;Response&lt;B&gt;&gt; + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;S::Future: 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;B: MessageBody + 'static,&nbsp;</span></h3></section></summary><div class="impl-items"><section id="method.apply_settings" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/actix_settings/lib.rs.html#156-223">source</a></span><a href="#method.apply_settings" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.apply_settings" class="fnname">apply_settings</a>&lt;A&gt;(self, settings: &amp;<a class="struct" href="struct.BasicSettings.html" title="struct actix_settings::BasicSettings">BasicSettings</a>&lt;A&gt;) -&gt; Self <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="https://docs.rs/serde/1.0.140/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>,&nbsp;</span></h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/actix_settings/trait.ApplySettings.js" data-ignore-extern-crates="actix_web" async></script></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> </div></details><h2 id="required-methods" class="small-section-header">Required Methods<a href="#required-methods" class="anchor"></a></h2><div class="methods"><details class="rustdoc-toggle" open><summary><div id="tymethod.apply_settings" class="method has-srclink"><div class="rightside"><a class="srclink" href="../src/actix_settings/lib.rs.html#243-245">source</a></div><h4 class="code-header">fn <a href="#tymethod.apply_settings" class="fnname">apply_settings</a>&lt;A&gt;(self, settings: &amp;<a class="struct" href="struct.BasicSettings.html" title="struct actix_settings::BasicSettings">BasicSettings</a>&lt;A&gt;) -&gt; Self <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="https://docs.rs/serde/1.0.140/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>,&nbsp;</span></h4></div></summary><div class="docblock"><p>Apply a <a href="./struct.BasicSettings.html"><code>BasicSettings</code></a> value to <code>self</code>.</p>
</div></details></div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle"><summary><section id="impl-ApplySettings-for-HttpServer%3CF%2C%20I%2C%20S%2C%20B%3E" class="impl has-srclink"><span class="rightside"><a class="srclink" href="../src/actix_settings/lib.rs.html#248-327">source</a></span><a href="#impl-ApplySettings-for-HttpServer%3CF%2C%20I%2C%20S%2C%20B%3E" class="anchor"></a><h3 class="code-header in-band">impl&lt;F, I, S, B&gt; <a class="trait" href="trait.ApplySettings.html" title="trait actix_settings::ApplySettings">ApplySettings</a> for HttpServer&lt;F, I, S, B&gt; <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>() -&gt; I + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;I: IntoServiceFactory&lt;S, Request&gt;,<br>&nbsp;&nbsp;&nbsp;&nbsp;S: ServiceFactory&lt;Request, Config = AppConfig&gt; + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;S::Error: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;WebError&gt; + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;S::InitError: <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;S::Response: <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.Into.html" title="trait core::convert::Into">Into</a>&lt;Response&lt;B&gt;&gt; + 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;S::Future: 'static,<br>&nbsp;&nbsp;&nbsp;&nbsp;B: MessageBody + 'static,&nbsp;</span></h3></section></summary><div class="impl-items"><section id="method.apply_settings" class="method trait-impl has-srclink"><span class="rightside"><a class="srclink" href="../src/actix_settings/lib.rs.html#259-326">source</a></span><a href="#method.apply_settings" class="anchor"></a><h4 class="code-header">fn <a href="#tymethod.apply_settings" class="fnname">apply_settings</a>&lt;A&gt;(self, settings: &amp;<a class="struct" href="struct.BasicSettings.html" title="struct actix_settings::BasicSettings">BasicSettings</a>&lt;A&gt;) -&gt; Self <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;A: <a class="trait" href="https://docs.rs/serde/1.0.140/serde/de/trait.DeserializeOwned.html" title="trait serde::de::DeserializeOwned">DeserializeOwned</a>,&nbsp;</span></h4></section></div></details><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><script type="text/javascript" src="../implementors/actix_settings/trait.ApplySettings.js" data-ignore-extern-crates="actix_web" async></script></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>

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `AtResult` type in crate `actix_settings`."><meta name="keywords" content="rust, rustlang, rust-lang, AtResult"><title>AtResult in actix_settings - Rust</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="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc type"><!--[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">&#9776;</button><a class="sidebar-logo" href="../actix_settings/index.html"><div class="logo-container"><img src="https://actix.rs/img/logo.png" 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"> <!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="Convenience type alias for `Result&lt;T, AtError&gt;`."><meta name="keywords" content="rust, rustlang, rust-lang, AtResult"><title>AtResult in actix_settings - Rust</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="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc type"><!--[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">&#9776;</button><a class="sidebar-logo" href="../actix_settings/index.html"><div class="logo-container"><img src="https://actix.rs/img/logo.png" 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 src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2 class="location"><a href="#">AtResult</a></h2><div class="sidebar-elems"><h2 class="location"><a href="index.html">In actix_settings</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../actix_settings/index.html"> <img src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2 class="location"><a href="#">AtResult</a></h2><div class="sidebar-elems"><h2 class="location"><a href="index.html">In actix_settings</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../actix_settings/index.html">
<img src="https://actix.rs/img/logo.png" 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="main-heading"><h1 class="fqn"><span class="in-band">Type Definition <a href="index.html">actix_settings</a>::<wbr><a class="type" href="#">AtResult</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/actix_settings/error.rs.html#5">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="docblock item-decl"><pre class="rust typedef"><code>pub type AtResult&lt;T&gt; = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.AtError.html" title="enum actix_settings::AtError">AtError</a>&gt;;</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> <img src="https://actix.rs/img/logo.png" 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="main-heading"><h1 class="fqn"><span class="in-band">Type Definition <a href="index.html">actix_settings</a>::<wbr><a class="type" href="#">AtResult</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/actix_settings/error.rs.html#6">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="docblock item-decl"><pre class="rust typedef"><code>pub type AtResult&lt;T&gt; = <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;T, <a class="enum" href="enum.AtError.html" title="enum actix_settings::AtError">AtError</a>&gt;;</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Convenience type alias for <code>Result&lt;T, AtError&gt;</code>.</p>
</div></details></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>

View File

@ -1,3 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `Settings` type in crate `actix_settings`."><meta name="keywords" content="rust, rustlang, rust-lang, Settings"><title>Settings in actix_settings - Rust</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="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc type"><!--[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">&#9776;</button><a class="sidebar-logo" href="../actix_settings/index.html"><div class="logo-container"><img src="https://actix.rs/img/logo.png" 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"> <!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="Convenience type alias for [`BasicSettings`] with no defined application-specific settings."><meta name="keywords" content="rust, rustlang, rust-lang, Settings"><title>Settings in actix_settings - Rust</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="sidebar-items.js"></script><script defer src="../main.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc type"><!--[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">&#9776;</button><a class="sidebar-logo" href="../actix_settings/index.html"><div class="logo-container"><img src="https://actix.rs/img/logo.png" 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 src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2 class="location"><a href="#">Settings</a></h2><div class="sidebar-elems"><h2 class="location"><a href="index.html">In actix_settings</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../actix_settings/index.html"> <img src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2 class="location"><a href="#">Settings</a></h2><div class="sidebar-elems"><h2 class="location"><a href="index.html">In actix_settings</a></h2></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../actix_settings/index.html">
<img src="https://actix.rs/img/logo.png" 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="main-heading"><h1 class="fqn"><span class="in-band">Type Definition <a href="index.html">actix_settings</a>::<wbr><a class="type" href="#">Settings</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/actix_settings/lib.rs.html#47">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="docblock item-decl"><pre class="rust typedef"><code>pub type Settings = <a class="struct" href="struct.BasicSettings.html" title="struct actix_settings::BasicSettings">BasicSettings</a>&lt;<a class="struct" href="struct.NoSettings.html" title="struct actix_settings::NoSettings">NoSettings</a>&gt;;</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> <img src="https://actix.rs/img/logo.png" 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="main-heading"><h1 class="fqn"><span class="in-band">Type Definition <a href="index.html">actix_settings</a>::<wbr><a class="type" href="#">Settings</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../src/actix_settings/lib.rs.html#111">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">&#x2212;</span>]</a></span></div><div class="docblock item-decl"><pre class="rust typedef"><code>pub type Settings = <a class="struct" href="struct.BasicSettings.html" title="struct actix_settings::BasicSettings">BasicSettings</a>&lt;<a class="struct" href="struct.NoSettings.html" title="struct actix_settings::NoSettings">NoSettings</a>&gt;;</code></pre></div><details class="rustdoc-toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Convenience type alias for <a href="struct.BasicSettings.html" title="BasicSettings"><code>BasicSettings</code></a> with no defined application-specific settings.</p>
</div></details></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>

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1 @@
<!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="Settings of Rustdoc"><meta name="keywords" content="rust, rustlang, rust-lang"><title>Rustdoc settings</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="./main.js"></script><noscript><link rel="stylesheet" href="./noscript.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="sidebar-logo" href="./actix_limitation/index.html"><div class="logo-container"><img src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2 class="location"></h2></nav><nav class="sidebar"><a class="sidebar-logo" href="./actix_limitation/index.html"><div class="logo-container"> <!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="Settings of Rustdoc"><meta name="keywords" content="rust, rustlang, rust-lang"><title>Rustdoc settings</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="./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 mod"><!--[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">&#9776;</button><a class="sidebar-logo" href="./actix_identity/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_identity/index.html"><div class="logo-container"><img class="rust-logo" src="./rust-logo.svg" alt="logo"></div></a><h2 class="location">Settings</h2><div class="sidebar-elems"></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="./actix_identity/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="main-heading"><h1 class="fqn"><span class="in-band">Rustdoc settings</span></h1><span class="out-of-band"><a id="back" href="javascript:void(0)" onclick="history.back();">Back</a></span></div><noscript><section>You need to enable Javascript be able to update your settings.</section></noscript><link rel="stylesheet" type="text/css" href="settings.css"><script defer src="settings.js"></script></section></div></main><div id="rustdoc-vars" data-root-path="./" data-current-crate="actix_identity" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (0f4bcadb4 2022-07-30)" ></div></body></html>
<img src="https://actix.rs/img/logo.png" alt="logo"></div></a><h2 class="location">Settings</h2><div class="sidebar-elems"></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="./actix_limitation/index.html">
<img src="https://actix.rs/img/logo.png" 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="main-heading"><h1 class="fqn"><span class="in-band">Rustdoc settings</span></h1><span class="out-of-band"><a id="back" href="javascript:void(0)" onclick="history.back();">Back</a></span></div><noscript><section>You need to enable Javascript be able to update your settings.</section></noscript><link rel="stylesheet" type="text/css" href="settings.css"><script defer src="settings.js"></script></section></div></main><div id="rustdoc-vars" data-root-path="./" data-current-crate="actix_limitation" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.64.0-nightly (0f4bcadb4 2022-07-30)" ></div></body></html>

View File

@ -123,16 +123,42 @@
<span id="121">121</span> <span id="121">121</span>
<span id="122">122</span> <span id="122">122</span>
<span id="123">123</span> <span id="123">123</span>
<span id="124">124</span>
<span id="125">125</span>
<span id="126">126</span>
<span id="127">127</span>
<span id="128">128</span>
<span id="129">129</span>
<span id="130">130</span>
<span id="131">131</span>
<span id="132">132</span>
<span id="133">133</span>
<span id="134">134</span>
<span id="135">135</span>
<span id="136">136</span>
<span id="137">137</span>
<span id="138">138</span>
<span id="139">139</span>
<span id="140">140</span>
<span id="141">141</span>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">env::VarError</span>, <span class="ident">io</span>, <span class="ident">num::ParseIntError</span>, <span class="ident">path::PathBuf</span>, <span class="ident">str::ParseBoolError</span>}; </pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">env::VarError</span>, <span class="ident">io</span>, <span class="ident">num::ParseIntError</span>, <span class="ident">path::PathBuf</span>, <span class="ident">str::ParseBoolError</span>};
<span class="kw">use</span> <span class="ident">toml::de::Error</span> <span class="kw">as</span> <span class="ident">TomlError</span>; <span class="kw">use</span> <span class="ident">toml::de::Error</span> <span class="kw">as</span> <span class="ident">TomlError</span>;
<span class="doccomment">/// Convenience type alias for `Result&lt;T, AtError&gt;`.</span>
<span class="kw">pub</span> <span class="kw">type</span> <span class="ident">AtResult</span><span class="op">&lt;</span><span class="ident">T</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">std::result::Result</span><span class="op">&lt;</span><span class="ident">T</span>, <span class="ident">AtError</span><span class="op">&gt;</span>; <span class="kw">pub</span> <span class="kw">type</span> <span class="ident">AtResult</span><span class="op">&lt;</span><span class="ident">T</span><span class="op">&gt;</span> <span class="op">=</span> <span class="ident">std::result::Result</span><span class="op">&lt;</span><span class="ident">T</span>, <span class="ident">AtError</span><span class="op">&gt;</span>;
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Clone</span>, <span class="ident">Debug</span>)]</span> <span class="doccomment">/// Errors that can be returned from methods in this crate.</span>
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>)]</span>
<span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">AtError</span> { <span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">AtError</span> {
<span class="doccomment">/// Environment variable does not exists or is invalid.</span>
<span class="ident">EnvVarError</span>(<span class="ident">VarError</span>), <span class="ident">EnvVarError</span>(<span class="ident">VarError</span>),
<span class="doccomment">/// File already exists on disk.</span>
<span class="ident">FileExists</span>(<span class="ident">PathBuf</span>), <span class="ident">FileExists</span>(<span class="ident">PathBuf</span>),
<span class="doccomment">/// Invalid value.</span>
<span class="attribute">#[<span class="ident">allow</span>(<span class="ident">missing_docs</span>)]</span>
<span class="ident">InvalidValue</span> { <span class="ident">InvalidValue</span> {
<span class="ident">expected</span>: <span class="kw-2">&amp;</span><span class="lifetime">&#39;static</span> <span class="ident">str</span>, <span class="ident">expected</span>: <span class="kw-2">&amp;</span><span class="lifetime">&#39;static</span> <span class="ident">str</span>,
<span class="ident">got</span>: <span class="ident">String</span>, <span class="ident">got</span>: <span class="ident">String</span>,
@ -140,10 +166,20 @@
<span class="ident">line</span>: <span class="ident">u32</span>, <span class="ident">line</span>: <span class="ident">u32</span>,
<span class="ident">column</span>: <span class="ident">u32</span>, <span class="ident">column</span>: <span class="ident">u32</span>,
}, },
<span class="doccomment">/// I/O error.</span>
<span class="ident">IoError</span>(<span class="ident">ioe::IoError</span>), <span class="ident">IoError</span>(<span class="ident">ioe::IoError</span>),
<span class="doccomment">/// Value is not a boolean.</span>
<span class="ident">ParseBoolError</span>(<span class="ident">ParseBoolError</span>), <span class="ident">ParseBoolError</span>(<span class="ident">ParseBoolError</span>),
<span class="doccomment">/// Value is not an integer.</span>
<span class="ident">ParseIntError</span>(<span class="ident">ParseIntError</span>), <span class="ident">ParseIntError</span>(<span class="ident">ParseIntError</span>),
<span class="doccomment">/// Value is not an address.</span>
<span class="ident">ParseAddressError</span>(<span class="ident">String</span>), <span class="ident">ParseAddressError</span>(<span class="ident">String</span>),
<span class="doccomment">/// Error deserializing as TOML.</span>
<span class="ident">TomlError</span>(<span class="ident">TomlError</span>), <span class="ident">TomlError</span>(<span class="ident">TomlError</span>),
} }

View File

@ -702,12 +702,174 @@
<span id="700">700</span> <span id="700">700</span>
<span id="701">701</span> <span id="701">701</span>
<span id="702">702</span> <span id="702">702</span>
<span id="703">703</span>
<span id="704">704</span>
<span id="705">705</span>
<span id="706">706</span>
<span id="707">707</span>
<span id="708">708</span>
<span id="709">709</span>
<span id="710">710</span>
<span id="711">711</span>
<span id="712">712</span>
<span id="713">713</span>
<span id="714">714</span>
<span id="715">715</span>
<span id="716">716</span>
<span id="717">717</span>
<span id="718">718</span>
<span id="719">719</span>
<span id="720">720</span>
<span id="721">721</span>
<span id="722">722</span>
<span id="723">723</span>
<span id="724">724</span>
<span id="725">725</span>
<span id="726">726</span>
<span id="727">727</span>
<span id="728">728</span>
<span id="729">729</span>
<span id="730">730</span>
<span id="731">731</span>
<span id="732">732</span>
<span id="733">733</span>
<span id="734">734</span>
<span id="735">735</span>
<span id="736">736</span>
<span id="737">737</span>
<span id="738">738</span>
<span id="739">739</span>
<span id="740">740</span>
<span id="741">741</span>
<span id="742">742</span>
<span id="743">743</span>
<span id="744">744</span>
<span id="745">745</span>
<span id="746">746</span>
<span id="747">747</span>
<span id="748">748</span>
<span id="749">749</span>
<span id="750">750</span>
<span id="751">751</span>
<span id="752">752</span>
<span id="753">753</span>
<span id="754">754</span>
<span id="755">755</span>
<span id="756">756</span>
<span id="757">757</span>
<span id="758">758</span>
<span id="759">759</span>
<span id="760">760</span>
<span id="761">761</span>
<span id="762">762</span>
<span id="763">763</span>
<span id="764">764</span>
<span id="765">765</span>
<span id="766">766</span>
<span id="767">767</span>
<span id="768">768</span>
<span id="769">769</span>
<span id="770">770</span>
<span id="771">771</span>
<span id="772">772</span>
<span id="773">773</span>
<span id="774">774</span>
<span id="775">775</span>
<span id="776">776</span>
<span id="777">777</span>
<span id="778">778</span>
<span id="779">779</span>
<span id="780">780</span>
<span id="781">781</span>
<span id="782">782</span>
<span id="783">783</span>
<span id="784">784</span>
<span id="785">785</span>
<span id="786">786</span>
<span id="787">787</span>
<span id="788">788</span>
<span id="789">789</span>
<span id="790">790</span>
<span id="791">791</span>
<span id="792">792</span>
<span id="793">793</span>
<span id="794">794</span>
<span id="795">795</span>
<span id="796">796</span>
<span id="797">797</span>
<span id="798">798</span>
<span id="799">799</span>
<span id="800">800</span>
<span id="801">801</span>
<span id="802">802</span>
<span id="803">803</span>
<span id="804">804</span>
<span id="805">805</span>
</pre><pre class="rust"><code><span class="doccomment">//! Easily manage Actix Web&#39;s settings from a TOML file and environment variables.</span> </pre><pre class="rust"><code><span class="doccomment">//! Easily manage Actix Web&#39;s settings from a TOML file and environment variables.</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! To get started add a [`Settings::parse_toml(&quot;./Server.toml&quot;)`](Settings::parse_toml) call to the</span>
<span class="doccomment">//! top of your main function. This will create a template file with descriptions of all the</span>
<span class="doccomment">//! configurable settings. You can change or remove anything in that file and it will be picked up</span>
<span class="doccomment">//! the next time you run your application.</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! Overriding parts of the file can be done from values using [`Settings::override_field`] or from</span>
<span class="doccomment">//! the environment using [`Settings::override_field_with_env_var`].</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! # Examples</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! See examples folder on GitHub for complete example.</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! ```ignore</span>
<span class="doccomment">//! # use actix_web::{</span>
<span class="doccomment">//! # get,</span>
<span class="doccomment">//! # middleware::{Compress, Condition, Logger},</span>
<span class="doccomment">//! # web, App, HttpServer,</span>
<span class="doccomment">//! # };</span>
<span class="doccomment">//! use actix_settings::{ApplySettings as _, Mode, Settings};</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! #[actix_web::main]</span>
<span class="doccomment">//! async fn main() -&gt; std::io::Result&lt;()&gt; {</span>
<span class="doccomment">//! let mut settings = Settings::parse_toml(&quot;./Server.toml&quot;)</span>
<span class="doccomment">//! .expect(&quot;Failed to parse `Settings` from Server.toml&quot;);</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! // If the environment variable `$APPLICATION__HOSTS` is set,</span>
<span class="doccomment">//! // have its value override the `settings.actix.hosts` setting:</span>
<span class="doccomment">//! Settings::override_field_with_env_var(&amp;mut settings.actix.hosts, &quot;APPLICATION__HOSTS&quot;)?;</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! init_logger(&amp;settings);</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! HttpServer::new({</span>
<span class="doccomment">//! // clone settings into each worker thread</span>
<span class="doccomment">//! let settings = settings.clone();</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! move || {</span>
<span class="doccomment">//! App::new()</span>
<span class="doccomment">//! // Include this `.wrap()` call for compression settings to take effect</span>
<span class="doccomment">//! .wrap(Condition::new(</span>
<span class="doccomment">//! settings.actix.enable_compression,</span>
<span class="doccomment">//! Compress::default(),</span>
<span class="doccomment">//! ))</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! // add request logger</span>
<span class="doccomment">//! .wrap(Logger::default())</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! // make `Settings` available to handlers</span>
<span class="doccomment">//! .app_data(web::Data::new(settings.clone()))</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! // add request handlers as normal</span>
<span class="doccomment">//! .service(index)</span>
<span class="doccomment">//! }</span>
<span class="doccomment">//! })</span>
<span class="doccomment">//! // apply the `Settings` to Actix Web&#39;s `HttpServer`</span>
<span class="doccomment">//! .apply_settings(&amp;settings)</span>
<span class="doccomment">//! .run()</span>
<span class="doccomment">//! .await</span>
<span class="doccomment">//! }</span>
<span class="doccomment">//! ```</span>
<span class="attribute">#![<span class="ident">forbid</span>(<span class="ident">unsafe_code</span>)]</span> <span class="attribute">#![<span class="ident">forbid</span>(<span class="ident">unsafe_code</span>)]</span>
<span class="attribute">#![<span class="ident">deny</span>(<span class="ident">rust_2018_idioms</span>, <span class="ident">nonstandard_style</span>)]</span> <span class="attribute">#![<span class="ident">deny</span>(<span class="ident">rust_2018_idioms</span>, <span class="ident">nonstandard_style</span>)]</span>
<span class="attribute">#![<span class="ident">warn</span>(<span class="ident">future_incompatible</span>, <span class="ident">missing_debug_implementations</span>)]</span> <span class="attribute">#![<span class="ident">warn</span>(<span class="ident">future_incompatible</span>, <span class="ident">missing_docs</span>, <span class="ident">missing_debug_implementations</span>)]</span>
<span class="comment">// #![warn(missing_docs)]</span>
<span class="attribute">#![<span class="ident">doc</span>(<span class="ident">html_logo_url</span> <span class="op">=</span> <span class="string">&quot;https://actix.rs/img/logo.png&quot;</span>)]</span> <span class="attribute">#![<span class="ident">doc</span>(<span class="ident">html_logo_url</span> <span class="op">=</span> <span class="string">&quot;https://actix.rs/img/logo.png&quot;</span>)]</span>
<span class="attribute">#![<span class="ident">doc</span>(<span class="ident">html_favicon_url</span> <span class="op">=</span> <span class="string">&quot;https://actix.rs/favicon.ico&quot;</span>)]</span> <span class="attribute">#![<span class="ident">doc</span>(<span class="ident">html_favicon_url</span> <span class="op">=</span> <span class="string">&quot;https://actix.rs/favicon.ico&quot;</span>)]</span>
@ -741,15 +903,21 @@
<span class="ident">NumWorkers</span>, <span class="ident">Timeout</span>, <span class="ident">Tls</span>, <span class="ident">NumWorkers</span>, <span class="ident">Timeout</span>, <span class="ident">Tls</span>,
}; };
<span class="doccomment">/// Wrapper for server and application-specific settings.</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">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">bound</span> <span class="op">=</span> <span class="string">&quot;A: Deserialize&lt;&#39;de&gt;&quot;</span>)]</span> <span class="attribute">#[<span class="ident">serde</span>(<span class="ident">bound</span> <span class="op">=</span> <span class="string">&quot;A: Deserialize&lt;&#39;de&gt;&quot;</span>)]</span>
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">BasicSettings</span><span class="op">&lt;</span><span class="ident">A</span><span class="op">&gt;</span> { <span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">BasicSettings</span><span class="op">&lt;</span><span class="ident">A</span><span class="op">&gt;</span> {
<span class="doccomment">/// Actix Web server settings.</span>
<span class="kw">pub</span> <span class="ident">actix</span>: <span class="ident">ActixSettings</span>, <span class="kw">pub</span> <span class="ident">actix</span>: <span class="ident">ActixSettings</span>,
<span class="doccomment">/// Application-specific settings.</span>
<span class="kw">pub</span> <span class="ident">application</span>: <span class="ident">A</span>, <span class="kw">pub</span> <span class="ident">application</span>: <span class="ident">A</span>,
} }
<span class="doccomment">/// Convenience type alias for [`BasicSettings`] with no defined application-specific settings.</span>
<span class="kw">pub</span> <span class="kw">type</span> <span class="ident">Settings</span> <span class="op">=</span> <span class="ident">BasicSettings</span><span class="op">&lt;</span><span class="ident">NoSettings</span><span class="op">&gt;</span>; <span class="kw">pub</span> <span class="kw">type</span> <span class="ident">Settings</span> <span class="op">=</span> <span class="ident">BasicSettings</span><span class="op">&lt;</span><span class="ident">NoSettings</span><span class="op">&gt;</span>;
<span class="doccomment">/// Marker type representing no defined application-specific settings.</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">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">non_exhaustive</span>]</span> <span class="attribute">#[<span class="ident">non_exhaustive</span>]</span>
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">NoSettings</span> {<span class="comment">/* NOTE: turning this into a unit struct will cause deserialization failures. */</span>} <span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">NoSettings</span> {<span class="comment">/* NOTE: turning this into a unit struct will cause deserialization failures. */</span>}
@ -758,14 +926,16 @@
<span class="kw">where</span> <span class="kw">where</span>
<span class="ident">A</span>: <span class="ident">de::DeserializeOwned</span>, <span class="ident">A</span>: <span class="ident">de::DeserializeOwned</span>,
{ {
<span class="doccomment">/// NOTE **DO NOT** mess with the ordering of the tables in this template.</span> <span class="comment">// NOTE **DO NOT** mess with the ordering of the tables in the default template.</span>
<span class="doccomment">/// Especially the `[application]` table needs to be last in order</span> <span class="comment">// Especially the `[application]` table needs to be last in order</span>
<span class="doccomment">/// for some tests to keep working.</span> <span class="comment">// for some tests to keep working.</span>
<span class="doccomment">/// Default settings file contents.</span>
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">const</span> <span class="ident">DEFAULT_TOML_TEMPLATE</span>: <span class="kw-2">&amp;</span><span class="lifetime">&#39;static</span> <span class="ident">str</span> <span class="op">=</span> <span class="macro">include_str!</span>(<span class="string">&quot;./defaults.toml&quot;</span>); <span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">const</span> <span class="ident">DEFAULT_TOML_TEMPLATE</span>: <span class="kw-2">&amp;</span><span class="lifetime">&#39;static</span> <span class="ident">str</span> <span class="op">=</span> <span class="macro">include_str!</span>(<span class="string">&quot;./defaults.toml&quot;</span>);
<span class="doccomment">/// Parse an instance of `Self` from a `TOML` file located at `filepath`.</span> <span class="doccomment">/// Parse an instance of `Self` from a TOML file located at `filepath`.</span>
<span class="doccomment">/// If the file doesn&#39;t exist, it is generated from the default `TOML`</span> <span class="doccomment">///</span>
<span class="doccomment">/// template, after which the newly generated file is read in and parsed.</span> <span class="doccomment">/// If the file doesn&#39;t exist, it is generated from the default TOML template, after which the</span>
<span class="doccomment">/// newly generated file is read in and parsed.</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">parse_toml</span><span class="op">&lt;</span><span class="ident">P</span><span class="op">&gt;</span>(<span class="ident">filepath</span>: <span class="ident">P</span>) -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> <span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">parse_toml</span><span class="op">&lt;</span><span class="ident">P</span><span class="op">&gt;</span>(<span class="ident">filepath</span>: <span class="ident">P</span>) -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span>
<span class="kw">where</span> <span class="kw">where</span>
<span class="ident">P</span>: <span class="ident">AsRef</span><span class="op">&lt;</span><span class="ident">Path</span><span class="op">&gt;</span>, <span class="ident">P</span>: <span class="ident">AsRef</span><span class="op">&lt;</span><span class="ident">Path</span><span class="op">&gt;</span>,
@ -777,43 +947,62 @@
} }
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">File::open</span>(<span class="ident">filepath</span>)<span class="question-mark">?</span>; <span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">f</span> <span class="op">=</span> <span class="ident">File::open</span>(<span class="ident">filepath</span>)<span class="question-mark">?</span>;
<span class="comment">// TODO: don&#39;t bail on metadata fail</span>
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">contents</span> <span class="op">=</span> <span class="ident">String::with_capacity</span>(<span class="ident">f</span>.<span class="ident">metadata</span>()<span class="question-mark">?</span>.<span class="ident">len</span>() <span class="kw">as</span> <span class="ident">usize</span>); <span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">contents</span> <span class="op">=</span> <span class="ident">String::with_capacity</span>(<span class="ident">f</span>.<span class="ident">metadata</span>()<span class="question-mark">?</span>.<span class="ident">len</span>() <span class="kw">as</span> <span class="ident">usize</span>);
<span class="ident">f</span>.<span class="ident">read_to_string</span>(<span class="kw-2">&amp;mut</span> <span class="ident">contents</span>)<span class="question-mark">?</span>; <span class="ident">f</span>.<span class="ident">read_to_string</span>(<span class="kw-2">&amp;mut</span> <span class="ident">contents</span>)<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(<span class="ident">toml::from_str</span>::<span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span>(<span class="kw-2">&amp;</span><span class="ident">contents</span>)<span class="question-mark">?</span>) <span class="prelude-val">Ok</span>(<span class="ident">toml::from_str</span>::<span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span>(<span class="kw-2">&amp;</span><span class="ident">contents</span>)<span class="question-mark">?</span>)
} }
<span class="doccomment">/// Parse an instance of `Self` straight from the default `TOML` template.</span> <span class="doccomment">/// Parse an instance of `Self` straight from the default TOML template.</span>
<span class="comment">// TODO: make infallible</span>
<span class="comment">// TODO: consider &quot;template&quot; rename</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">from_default_template</span>() -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> { <span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">from_default_template</span>() -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> {
<span class="ident"><span class="self">Self</span>::from_template</span>(<span class="ident"><span class="self">Self</span>::DEFAULT_TOML_TEMPLATE</span>) <span class="ident"><span class="self">Self</span>::from_template</span>(<span class="ident"><span class="self">Self</span>::DEFAULT_TOML_TEMPLATE</span>)
} }
<span class="doccomment">/// Parse an instance of `Self` straight from the default `TOML` template.</span> <span class="doccomment">/// Parse an instance of `Self` straight from the default TOML template.</span>
<span class="comment">// TODO: consider &quot;template&quot; rename</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">from_template</span>(<span class="ident">template</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> { <span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">from_template</span>(<span class="ident">template</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span><span class="self">Self</span><span class="op">&gt;</span> {
<span class="prelude-val">Ok</span>(<span class="ident">toml::from_str</span>(<span class="ident">template</span>)<span class="question-mark">?</span>) <span class="prelude-val">Ok</span>(<span class="ident">toml::from_str</span>(<span class="ident">template</span>)<span class="question-mark">?</span>)
} }
<span class="doccomment">/// Write the default `TOML` template to a new file, to be located</span> <span class="doccomment">/// Writes the default TOML template to a new file, located at `filepath`.</span>
<span class="doccomment">/// at `filepath`. Return a `Error::FileExists(_)` error if a</span> <span class="doccomment">///</span>
<span class="doccomment">/// file already exists at that location.</span> <span class="doccomment">/// # Errors</span>
<span class="doccomment">/// Returns a [`FileExists`](crate::AtError::FileExists) error if a file already exists at that</span>
<span class="doccomment">/// location.</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">write_toml_file</span><span class="op">&lt;</span><span class="ident">P</span><span class="op">&gt;</span>(<span class="ident">filepath</span>: <span class="ident">P</span>) -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span>()<span class="op">&gt;</span> <span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">write_toml_file</span><span class="op">&lt;</span><span class="ident">P</span><span class="op">&gt;</span>(<span class="ident">filepath</span>: <span class="ident">P</span>) -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span>()<span class="op">&gt;</span>
<span class="kw">where</span> <span class="kw">where</span>
<span class="ident">P</span>: <span class="ident">AsRef</span><span class="op">&lt;</span><span class="ident">Path</span><span class="op">&gt;</span>, <span class="ident">P</span>: <span class="ident">AsRef</span><span class="op">&lt;</span><span class="ident">Path</span><span class="op">&gt;</span>,
{ {
<span class="kw">let</span> <span class="ident">filepath</span> <span class="op">=</span> <span class="ident">filepath</span>.<span class="ident">as_ref</span>(); <span class="kw">let</span> <span class="ident">filepath</span> <span class="op">=</span> <span class="ident">filepath</span>.<span class="ident">as_ref</span>();
<span class="kw">let</span> <span class="ident">contents</span> <span class="op">=</span> <span class="ident"><span class="self">Self</span>::DEFAULT_TOML_TEMPLATE</span>.<span class="ident">trim</span>();
<span class="kw">if</span> <span class="ident">filepath</span>.<span class="ident">exists</span>() { <span class="kw">if</span> <span class="ident">filepath</span>.<span class="ident">exists</span>() {
<span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">AtError::FileExists</span>(<span class="ident">filepath</span>.<span class="ident">to_path_buf</span>())); <span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">AtError::FileExists</span>(<span class="ident">filepath</span>.<span class="ident">to_path_buf</span>()));
} }
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">File::create</span>(<span class="ident">filepath</span>)<span class="question-mark">?</span>; <span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">file</span> <span class="op">=</span> <span class="ident">File::create</span>(<span class="ident">filepath</span>)<span class="question-mark">?</span>;
<span class="ident">file</span>.<span class="ident">write_all</span>(<span class="ident">contents</span>.<span class="ident">as_bytes</span>())<span class="question-mark">?</span>; <span class="ident">file</span>.<span class="ident">write_all</span>(<span class="ident"><span class="self">Self</span>::DEFAULT_TOML_TEMPLATE</span>.<span class="ident">trim</span>().<span class="ident">as_bytes</span>())<span class="question-mark">?</span>;
<span class="ident">file</span>.<span class="ident">flush</span>()<span class="question-mark">?</span>; <span class="ident">file</span>.<span class="ident">flush</span>()<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(()) <span class="prelude-val">Ok</span>(())
} }
<span class="doccomment">/// Attempts to parse `value` and override the referenced `field`.</span>
<span class="doccomment">///</span>
<span class="doccomment">/// # Examples</span>
<span class="doccomment">/// ```</span>
<span class="doccomment">/// use actix_settings::{Settings, Mode};</span>
<span class="doccomment">///</span>
<span class="doccomment">/// # fn inner() -&gt; actix_settings::AtResult&lt;()&gt; {</span>
<span class="doccomment">/// let mut settings = Settings::from_default_template()?;</span>
<span class="doccomment">/// assert_eq!(settings.actix.mode, Mode::Development);</span>
<span class="doccomment">///</span>
<span class="doccomment">/// Settings::override_field(&amp;mut settings.actix.mode, &quot;production&quot;)?;</span>
<span class="doccomment">/// assert_eq!(settings.actix.mode, Mode::Production);</span>
<span class="doccomment">/// # Ok(()) }</span>
<span class="doccomment">/// ```</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">override_field</span><span class="op">&lt;</span><span class="ident">F</span>, <span class="ident">V</span><span class="op">&gt;</span>(<span class="ident">field</span>: <span class="kw-2">&amp;mut</span> <span class="ident">F</span>, <span class="ident">value</span>: <span class="ident">V</span>) -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span>()<span class="op">&gt;</span> <span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">override_field</span><span class="op">&lt;</span><span class="ident">F</span>, <span class="ident">V</span><span class="op">&gt;</span>(<span class="ident">field</span>: <span class="kw-2">&amp;mut</span> <span class="ident">F</span>, <span class="ident">value</span>: <span class="ident">V</span>) -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span>()<span class="op">&gt;</span>
<span class="kw">where</span> <span class="kw">where</span>
<span class="ident">F</span>: <span class="ident">Parse</span>, <span class="ident">F</span>: <span class="ident">Parse</span>,
@ -823,6 +1012,22 @@
<span class="prelude-val">Ok</span>(()) <span class="prelude-val">Ok</span>(())
} }
<span class="doccomment">/// Attempts to read an environment variable, parse it, and override the referenced `field`.</span>
<span class="doccomment">///</span>
<span class="doccomment">/// # Examples</span>
<span class="doccomment">/// ```</span>
<span class="doccomment">/// use actix_settings::{Settings, Mode};</span>
<span class="doccomment">///</span>
<span class="doccomment">/// std::env::set_var(&quot;OVERRIDE__MODE&quot;, &quot;production&quot;);</span>
<span class="doccomment">///</span>
<span class="doccomment">/// # fn inner() -&gt; actix_settings::AtResult&lt;()&gt; {</span>
<span class="doccomment">/// let mut settings = Settings::from_default_template()?;</span>
<span class="doccomment">/// assert_eq!(settings.actix.mode, Mode::Development);</span>
<span class="doccomment">///</span>
<span class="doccomment">/// Settings::override_field_with_env_var(&amp;mut settings.actix.mode, &quot;OVERRIDE__MODE&quot;)?;</span>
<span class="doccomment">/// assert_eq!(settings.actix.mode, Mode::Production);</span>
<span class="doccomment">/// # Ok(()) }</span>
<span class="doccomment">/// ```</span>
<span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">override_field_with_env_var</span><span class="op">&lt;</span><span class="ident">F</span>, <span class="ident">N</span><span class="op">&gt;</span>(<span class="ident">field</span>: <span class="kw-2">&amp;mut</span> <span class="ident">F</span>, <span class="ident">var_name</span>: <span class="ident">N</span>) -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span>()<span class="op">&gt;</span> <span class="kw">pub</span> <span class="kw">fn</span> <span class="ident">override_field_with_env_var</span><span class="op">&lt;</span><span class="ident">F</span>, <span class="ident">N</span><span class="op">&gt;</span>(<span class="ident">field</span>: <span class="kw-2">&amp;mut</span> <span class="ident">F</span>, <span class="ident">var_name</span>: <span class="ident">N</span>) -&gt; <span class="ident">AtResult</span><span class="op">&lt;</span>()<span class="op">&gt;</span>
<span class="kw">where</span> <span class="kw">where</span>
<span class="ident">F</span>: <span class="ident">Parse</span>, <span class="ident">F</span>: <span class="ident">Parse</span>,
@ -836,6 +1041,7 @@
} }
} }
<span class="doccomment">/// Extension trait for applying parsed settings to the server object.</span>
<span class="kw">pub</span> <span class="kw">trait</span> <span class="ident">ApplySettings</span> { <span class="kw">pub</span> <span class="kw">trait</span> <span class="ident">ApplySettings</span> {
<span class="doccomment">/// Apply a [`BasicSettings`] value to `self`.</span> <span class="doccomment">/// Apply a [`BasicSettings`] value to `self`.</span>
<span class="doccomment">///</span> <span class="doccomment">///</span>
@ -904,9 +1110,9 @@
<span class="self">self</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_timeout</span> { <span class="self">self</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_timeout</span> {
<span class="ident">Timeout::Default</span> =&gt; <span class="self">self</span>, <span class="ident">Timeout::Default</span> =&gt; <span class="self">self</span>,
<span class="ident">Timeout::Milliseconds</span>(<span class="ident">n</span>) =&gt; { <span class="ident">Timeout::Milliseconds</span>(<span class="ident">n</span>) =&gt; {
<span class="self">self</span>.<span class="ident">client_disconnect_timeout</span>(<span class="ident">Duration::from_millis</span>(<span class="ident">n</span> <span class="kw">as</span> <span class="ident">u64</span>)) <span class="self">self</span>.<span class="ident">client_request_timeout</span>(<span class="ident">Duration::from_millis</span>(<span class="ident">n</span> <span class="kw">as</span> <span class="ident">u64</span>))
} }
<span class="ident">Timeout::Seconds</span>(<span class="ident">n</span>) =&gt; <span class="self">self</span>.<span class="ident">client_disconnect_timeout</span>(<span class="ident">Duration::from_secs</span>(<span class="ident">n</span> <span class="kw">as</span> <span class="ident">u64</span>)), <span class="ident">Timeout::Seconds</span>(<span class="ident">n</span>) =&gt; <span class="self">self</span>.<span class="ident">client_request_timeout</span>(<span class="ident">Duration::from_secs</span>(<span class="ident">n</span> <span class="kw">as</span> <span class="ident">u64</span>)),
}; };
<span class="self">self</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_shutdown</span> { <span class="self">self</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">settings</span>.<span class="ident">actix</span>.<span class="ident">client_shutdown</span> {

View File

@ -38,11 +38,15 @@
<span id="36">36</span> <span id="36">36</span>
<span id="37">37</span> <span id="37">37</span>
<span id="38">38</span> <span id="38">38</span>
<span id="39">39</span>
<span id="40">40</span>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">path::PathBuf</span>, <span class="ident">str::FromStr</span>}; </pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std</span>::{<span class="ident">path::PathBuf</span>, <span class="ident">str::FromStr</span>};
<span class="kw">use</span> <span class="ident"><span class="kw">crate</span>::AtError</span>; <span class="kw">use</span> <span class="ident"><span class="kw">crate</span>::AtError</span>;
<span class="doccomment">/// A specialized `FromStr` trait that returns [`AtError`] errors</span>
<span class="kw">pub</span> <span class="kw">trait</span> <span class="ident">Parse</span>: <span class="ident">Sized</span> { <span class="kw">pub</span> <span class="kw">trait</span> <span class="ident">Parse</span>: <span class="ident">Sized</span> {
<span class="doccomment">/// Parse `Self` from `string`.</span>
<span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">string</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) -&gt; <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="self">Self</span>, <span class="ident">AtError</span><span class="op">&gt;</span>; <span class="kw">fn</span> <span class="ident">parse</span>(<span class="ident">string</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) -&gt; <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="self">Self</span>, <span class="ident">AtError</span><span class="op">&gt;</span>;
} }

View File

@ -89,6 +89,10 @@
<span id="87">87</span> <span id="87">87</span>
<span id="88">88</span> <span id="88">88</span>
<span id="89">89</span> <span id="89">89</span>
<span id="90">90</span>
<span id="91">91</span>
<span id="92">92</span>
<span id="93">93</span>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">once_cell::sync::Lazy</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">regex::Regex</span>;
<span class="kw">use</span> <span class="ident">serde::Deserialize</span>; <span class="kw">use</span> <span class="ident">serde::Deserialize</span>;
@ -128,9 +132,13 @@
.<span class="ident">expect</span>(<span class="string">&quot;Failed to compile regex: ADDRS_REGEX&quot;</span>) .<span class="ident">expect</span>(<span class="string">&quot;Failed to compile regex: ADDRS_REGEX&quot;</span>)
}); });
<span class="doccomment">/// A host/port pair for the server to bind to.</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">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="kw">struct</span> <span class="ident">Address</span> {
<span class="doccomment">/// Host part of 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">host</span>: <span class="ident">String</span>,
<span class="doccomment">/// Port part of address.</span>
<span class="kw">pub</span> <span class="ident">port</span>: <span class="ident">u16</span>, <span class="kw">pub</span> <span class="ident">port</span>: <span class="ident">u16</span>,
} }

View File

@ -59,15 +59,37 @@
<span id="57">57</span> <span id="57">57</span>
<span id="58">58</span> <span id="58">58</span>
<span id="59">59</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>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</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="ident">serde::de</span>;
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>}; <span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>};
<span class="doccomment">/// The maximum number of pending connections.</span>
<span class="doccomment">///</span>
<span class="doccomment">/// This refers to the number of clients that can be waiting to be served. Exceeding this number</span>
<span class="doccomment">/// results in the client getting an error when attempting to connect. It should only affect servers</span>
<span class="doccomment">/// under significant load.</span>
<span class="doccomment">///</span>
<span class="doccomment">/// Generally set in the 642048 range. The default value is 2048. Takes a string value: Either</span>
<span class="doccomment">/// &quot;default&quot;, or an integer N &gt; 0 e.g. &quot;6&quot;.</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="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="kw">pub</span> <span class="kw">enum</span> <span class="ident">Backlog</span> {
<span class="doccomment">/// The default number of connections. See struct docs.</span>
<span class="ident">Default</span>, <span class="ident">Default</span>,
<span class="doccomment">/// A specific number of connections.</span>
<span class="ident">Manual</span>(<span class="ident">usize</span>), <span class="ident">Manual</span>(<span class="ident">usize</span>),
} }

View File

@ -82,6 +82,19 @@
<span id="80">80</span> <span id="80">80</span>
<span id="81">81</span> <span id="81">81</span>
<span id="82">82</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>
<span id="90">90</span>
<span id="91">91</span>
<span id="92">92</span>
<span id="93">93</span>
<span id="94">94</span>
<span id="95">95</span>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</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">once_cell::sync::Lazy</span>;
@ -90,11 +103,24 @@
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>}; <span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>};
<span class="doccomment">/// The server keep-alive preference.</span>
<span class="doccomment">///</span>
<span class="doccomment">/// By default keep alive is set to 5 seconds. Takes a string value: Either &quot;default&quot;, &quot;disabled&quot;,</span>
<span class="doccomment">/// &quot;os&quot;, or a string of the format &quot;N seconds&quot; where N is an integer &gt; 0 e.g. &quot;6 seconds&quot;.</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="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="kw">pub</span> <span class="kw">enum</span> <span class="ident">KeepAlive</span> {
<span class="doccomment">/// The default keep-alive as defined by Actix Web.</span>
<span class="ident">Default</span>, <span class="ident">Default</span>,
<span class="doccomment">/// Disable keep-alive.</span>
<span class="ident">Disabled</span>, <span class="ident">Disabled</span>,
<span class="doccomment">/// Let the OS determine keep-alive duration.</span>
<span class="doccomment">///</span>
<span class="doccomment">/// Note: this is usually quite long.</span>
<span class="ident">Os</span>, <span class="ident">Os</span>,
<span class="doccomment">/// A specific keep-alive duration (in seconds).</span>
<span class="ident">Seconds</span>(<span class="ident">usize</span>), <span class="ident">Seconds</span>(<span class="ident">usize</span>),
} }

View File

@ -59,15 +59,31 @@
<span id="57">57</span> <span id="57">57</span>
<span id="58">58</span> <span id="58">58</span>
<span id="59">59</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>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</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="ident">serde::de</span>;
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>}; <span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>};
<span class="doccomment">/// The maximum per-worker concurrent TLS connection limit.</span>
<span class="doccomment">///</span>
<span class="doccomment">/// All listeners will stop accepting connections when this limit is reached. It can be used to</span>
<span class="doccomment">/// limit the global TLS CPU usage. By default max connections is set to a 256. Takes a string</span>
<span class="doccomment">/// value: Either &quot;default&quot;, or an integer N &gt; 0 e.g. &quot;6&quot;.</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="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="kw">pub</span> <span class="kw">enum</span> <span class="ident">MaxConnectionRate</span> {
<span class="doccomment">/// The default connection limit. See struct docs.</span>
<span class="ident">Default</span>, <span class="ident">Default</span>,
<span class="doccomment">/// A specific connection limit.</span>
<span class="ident">Manual</span>(<span class="ident">usize</span>), <span class="ident">Manual</span>(<span class="ident">usize</span>),
} }

View File

@ -59,15 +59,31 @@
<span id="57">57</span> <span id="57">57</span>
<span id="58">58</span> <span id="58">58</span>
<span id="59">59</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>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</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="ident">serde::de</span>;
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>}; <span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>};
<span class="doccomment">/// The maximum per-worker number of concurrent connections.</span>
<span class="doccomment">///</span>
<span class="doccomment">/// All socket listeners will stop accepting connections when this limit is reached for each worker.</span>
<span class="doccomment">/// By default max connections is set to a 25k. Takes a string value: Either &quot;default&quot;, or an</span>
<span class="doccomment">/// integer N &gt; 0 e.g. &quot;6&quot;.</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="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="kw">pub</span> <span class="kw">enum</span> <span class="ident">MaxConnections</span> {
<span class="doccomment">/// The default number of connections. See struct docs.</span>
<span class="ident">Default</span>, <span class="ident">Default</span>,
<span class="doccomment">/// A specific number of connections.</span>
<span class="ident">Manual</span>(<span class="ident">usize</span>), <span class="ident">Manual</span>(<span class="ident">usize</span>),
} }

View File

@ -40,6 +40,31 @@
<span id="38">38</span> <span id="38">38</span>
<span id="39">39</span> <span id="39">39</span>
<span id="40">40</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>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">serde::Deserialize</span>; </pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">serde::Deserialize</span>;
<span class="kw">mod</span> <span class="ident">address</span>; <span class="kw">mod</span> <span class="ident">address</span>;
@ -66,18 +91,43 @@
<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">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">&quot;kebab-case&quot;</span>)]</span> <span class="attribute">#[<span class="ident">serde</span>(<span class="ident">rename_all</span> <span class="op">=</span> <span class="string">&quot;kebab-case&quot;</span>)]</span>
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">ActixSettings</span> { <span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">ActixSettings</span> {
<span class="doccomment">/// List of addresses for the server to bind to.</span>
<span class="kw">pub</span> <span class="ident">hosts</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">Address</span><span class="op">&gt;</span>, <span class="kw">pub</span> <span class="ident">hosts</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">Address</span><span class="op">&gt;</span>,
<span class="kw">pub</span> <span class="ident">mode</span>: <span class="ident">mode::Mode</span>,
<span class="doccomment">/// Marker of intended deployment environment.</span>
<span class="kw">pub</span> <span class="ident">mode</span>: <span class="ident">Mode</span>,
<span class="doccomment">/// True if the [`Compress`](actix_web::middleware::Compress) middleware should be enabled.</span>
<span class="kw">pub</span> <span class="ident">enable_compression</span>: <span class="ident">bool</span>, <span class="kw">pub</span> <span class="ident">enable_compression</span>: <span class="ident">bool</span>,
<span class="doccomment">/// True if the [`Logger`](actix_web::middleware::Logger) middleware should be enabled.</span>
<span class="kw">pub</span> <span class="ident">enable_log</span>: <span class="ident">bool</span>, <span class="kw">pub</span> <span class="ident">enable_log</span>: <span class="ident">bool</span>,
<span class="doccomment">/// The number of workers that the server should start.</span>
<span class="kw">pub</span> <span class="ident">num_workers</span>: <span class="ident">NumWorkers</span>, <span class="kw">pub</span> <span class="ident">num_workers</span>: <span class="ident">NumWorkers</span>,
<span class="doccomment">/// The maximum number of pending connections.</span>
<span class="kw">pub</span> <span class="ident">backlog</span>: <span class="ident">Backlog</span>, <span class="kw">pub</span> <span class="ident">backlog</span>: <span class="ident">Backlog</span>,
<span class="doccomment">/// The per-worker maximum number of concurrent connections.</span>
<span class="kw">pub</span> <span class="ident">max_connections</span>: <span class="ident">MaxConnections</span>, <span class="kw">pub</span> <span class="ident">max_connections</span>: <span class="ident">MaxConnections</span>,
<span class="doccomment">/// The per-worker maximum concurrent TLS connection limit.</span>
<span class="kw">pub</span> <span class="ident">max_connection_rate</span>: <span class="ident">MaxConnectionRate</span>, <span class="kw">pub</span> <span class="ident">max_connection_rate</span>: <span class="ident">MaxConnectionRate</span>,
<span class="doccomment">/// Server keep-alive preference.</span>
<span class="kw">pub</span> <span class="ident">keep_alive</span>: <span class="ident">KeepAlive</span>, <span class="kw">pub</span> <span class="ident">keep_alive</span>: <span class="ident">KeepAlive</span>,
<span class="doccomment">/// Timeout duration for reading client request header.</span>
<span class="kw">pub</span> <span class="ident">client_timeout</span>: <span class="ident">Timeout</span>, <span class="kw">pub</span> <span class="ident">client_timeout</span>: <span class="ident">Timeout</span>,
<span class="doccomment">/// Timeout duration for connection shutdown.</span>
<span class="kw">pub</span> <span class="ident">client_shutdown</span>: <span class="ident">Timeout</span>, <span class="kw">pub</span> <span class="ident">client_shutdown</span>: <span class="ident">Timeout</span>,
<span class="doccomment">/// Timeout duration for graceful worker shutdown.</span>
<span class="kw">pub</span> <span class="ident">shutdown_timeout</span>: <span class="ident">Timeout</span>, <span class="kw">pub</span> <span class="ident">shutdown_timeout</span>: <span class="ident">Timeout</span>,
<span class="doccomment">/// TLS (HTTPS) configuration.</span>
<span class="kw">pub</span> <span class="ident">tls</span>: <span class="ident">Tls</span>, <span class="kw">pub</span> <span class="ident">tls</span>: <span class="ident">Tls</span>,
} }
</code></pre></div> </code></pre></div>

View File

@ -23,14 +23,22 @@
<span id="21">21</span> <span id="21">21</span>
<span id="22">22</span> <span id="22">22</span>
<span id="23">23</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>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">serde::Deserialize</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">AtResult</span>, <span class="ident">Parse</span>}; <span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtResult</span>, <span class="ident">Parse</span>};
<span class="doccomment">/// Marker of intended deployment environment.</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">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">&quot;lowercase&quot;</span>)]</span> <span class="attribute">#[<span class="ident">serde</span>(<span class="ident">rename_all</span> <span class="op">=</span> <span class="string">&quot;lowercase&quot;</span>)]</span>
<span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">Mode</span> { <span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">Mode</span> {
<span class="doccomment">/// Marks development environment.</span>
<span class="ident">Development</span>, <span class="ident">Development</span>,
<span class="doccomment">/// Marks production environment.</span>
<span class="ident">Production</span>, <span class="ident">Production</span>,
} }

View File

@ -59,15 +59,29 @@
<span id="57">57</span> <span id="57">57</span>
<span id="58">58</span> <span id="58">58</span>
<span id="59">59</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>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</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="ident">serde::de</span>;
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>}; <span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>};
<span class="doccomment">/// The number of workers that the server should start.</span>
<span class="doccomment">///</span>
<span class="doccomment">/// By default the number of available logical cpu cores is used. Takes a string value: Either</span>
<span class="doccomment">/// &quot;default&quot;, or an integer N &gt; 0 e.g. &quot;6&quot;.</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="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="kw">pub</span> <span class="kw">enum</span> <span class="ident">NumWorkers</span> {
<span class="doccomment">/// The default number of workers. See struct docs.</span>
<span class="ident">Default</span>, <span class="ident">Default</span>,
<span class="doccomment">/// A specific number of workers.</span>
<span class="ident">Manual</span>(<span class="ident">usize</span>), <span class="ident">Manual</span>(<span class="ident">usize</span>),
} }

View File

@ -88,6 +88,16 @@
<span id="86">86</span> <span id="86">86</span>
<span id="87">87</span> <span id="87">87</span>
<span id="88">88</span> <span id="88">88</span>
<span id="89">89</span>
<span id="90">90</span>
<span id="91">91</span>
<span id="92">92</span>
<span id="93">93</span>
<span id="94">94</span>
<span id="95">95</span>
<span id="96">96</span>
<span id="97">97</span>
<span id="98">98</span>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::fmt</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">once_cell::sync::Lazy</span>;
@ -96,10 +106,16 @@
<span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>}; <span class="kw">use</span> <span class="kw">crate</span>::{<span class="ident">AtError</span>, <span class="ident">AtResult</span>, <span class="ident">Parse</span>};
<span class="doccomment">/// A timeout duration in milliseconds or seconds.</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="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="kw">pub</span> <span class="kw">enum</span> <span class="ident">Timeout</span> {
<span class="doccomment">/// The default timeout. Depends on context.</span>
<span class="ident">Default</span>, <span class="ident">Default</span>,
<span class="doccomment">/// Timeout in milliseconds.</span>
<span class="ident">Milliseconds</span>(<span class="ident">usize</span>), <span class="ident">Milliseconds</span>(<span class="ident">usize</span>),
<span class="doccomment">/// Timeout in seconds.</span>
<span class="ident">Seconds</span>(<span class="ident">usize</span>), <span class="ident">Seconds</span>(<span class="ident">usize</span>),
} }
@ -124,18 +140,22 @@
}) })
} }
} }
<span class="kw">match</span> <span class="ident">string</span> { <span class="kw">match</span> <span class="ident">string</span> {
<span class="string">&quot;default&quot;</span> =&gt; <span class="prelude-val">Ok</span>(<span class="ident">Timeout::Default</span>), <span class="string">&quot;default&quot;</span> =&gt; <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>) =&gt; <span class="macro">invalid_value!</span>(<span class="ident">string</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>) =&gt; <span class="macro">invalid_value!</span>(<span class="ident">string</span>),
<span class="ident">string</span> =&gt; <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="ident">string</span> =&gt; <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>) =&gt; <span class="macro">invalid_value!</span>(<span class="ident">string</span>), (<span class="prelude-val">None</span>, <span class="kw">_</span>) <span class="op">|</span> (<span class="kw">_</span>, <span class="prelude-val">None</span>) =&gt; <span class="macro">invalid_value!</span>(<span class="ident">string</span>),
(<span class="kw">_</span>, <span class="prelude-val">None</span>) =&gt; <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>)) =&gt; { (<span class="prelude-val">Some</span>(<span class="ident">digits</span>), <span class="prelude-val">Some</span>(<span class="ident">unit</span>)) =&gt; {
<span class="kw">let</span> <span class="ident">digits</span> <span class="op">=</span> <span class="kw-2">&amp;</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">digits</span> <span class="op">=</span> <span class="kw-2">&amp;</span><span class="ident">string</span>[<span class="ident">digits</span>.<span class="ident">range</span>()];
<span class="kw">let</span> <span class="ident">unit</span> <span class="op">=</span> <span class="kw-2">&amp;</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">let</span> <span class="ident">unit</span> <span class="op">=</span> <span class="kw-2">&amp;</span><span class="ident">string</span>[<span class="ident">unit</span>.<span class="ident">range</span>()];
<span class="kw">match</span> (<span class="ident">digits</span>.<span class="ident">parse</span>(), <span class="ident">unit</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">&quot;milliseconds&quot;</span>) =&gt; <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">n</span>), <span class="string">&quot;milliseconds&quot;</span>) =&gt; <span class="prelude-val">Ok</span>(<span class="ident">Timeout::Milliseconds</span>(<span class="ident">n</span>)),
(<span class="prelude-val">Ok</span>(<span class="ident">v</span>), <span class="string">&quot;seconds&quot;</span>) =&gt; <span class="prelude-val">Ok</span>(<span class="ident">Timeout::Seconds</span>(<span class="ident">v</span>)), (<span class="prelude-val">Ok</span>(<span class="ident">n</span>), <span class="string">&quot;seconds&quot;</span>) =&gt; <span class="prelude-val">Ok</span>(<span class="ident">Timeout::Seconds</span>(<span class="ident">n</span>)),
<span class="kw">_</span> =&gt; <span class="macro">invalid_value!</span>(<span class="ident">string</span>), <span class="kw">_</span> =&gt; <span class="macro">invalid_value!</span>(<span class="ident">string</span>),
} }
} }

View File

@ -11,15 +11,29 @@
<span id="9">9</span> <span id="9">9</span>
<span id="10">10</span> <span id="10">10</span>
<span id="11">11</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>
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident">std::path::PathBuf</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="kw">use</span> <span class="ident">serde::Deserialize</span>;
<span class="doccomment">/// TLS (HTTPS) configuration.</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">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">&quot;kebab-case&quot;</span>)]</span> <span class="attribute">#[<span class="ident">serde</span>(<span class="ident">rename_all</span> <span class="op">=</span> <span class="string">&quot;kebab-case&quot;</span>)]</span>
<span class="attribute">#[<span class="ident">doc</span>(<span class="ident">alias</span> <span class="op">=</span> <span class="string">&quot;ssl&quot;</span>, <span class="ident">alias</span> <span class="op">=</span> <span class="string">&quot;https&quot;</span>)]</span>
<span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">Tls</span> { <span class="kw">pub</span> <span class="kw">struct</span> <span class="ident">Tls</span> {
<span class="doccomment">/// Tru if accepting TLS connections should be enabled.</span>
<span class="kw">pub</span> <span class="ident">enabled</span>: <span class="ident">bool</span>, <span class="kw">pub</span> <span class="ident">enabled</span>: <span class="ident">bool</span>,
<span class="doccomment">/// Path to certificate `.pem` file.</span>
<span class="kw">pub</span> <span class="ident">certificate</span>: <span class="ident">PathBuf</span>, <span class="kw">pub</span> <span class="ident">certificate</span>: <span class="ident">PathBuf</span>,
<span class="doccomment">/// Path to private key `.pem` file.</span>
<span class="kw">pub</span> <span class="ident">private_key</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> </code></pre></div>