<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><metaname="generator"content="rustdoc"><metaname="description"content="Easily manage Actix Web’s settings from a TOML file and environment variables."><title>actix_settings - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><linkrel="stylesheet"href="../static.files/normalize-76eba96aa4d2e634.css"><linkrel="stylesheet"href="../static.files/rustdoc-dd39b87e5fcfba68.css"><metaname="rustdoc-vars"data-root-path="../"data-static-root-path="../static.files/"data-current-crate="actix_settings"data-themes=""data-resource-suffix=""data-rustdoc-version="1.81.0-nightly (b5b13568f 2024-06-10)"data-channel="nightly"data-search-js="search-0fe7219eb170c82e.js"data-settings-js="settings-4313503d2e1961c2.js"><scriptsrc="../static.files/storage-118b08c4c78b968e.js"></script><scriptdefersrc="../crates.js"></script><scriptdefersrc="../static.files/main-20a3ad099b048cf2.js"></script><noscript><linkrel="stylesheet"href="../static.files/noscript-df360f571f6edeae.css"></noscript><linkrel="icon"href="https://actix.rs/favicon.ico"></head><bodyclass="rustdoc mod crate"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><navclass="mobile-topbar"><buttonclass="sidebar-menu-toggle"title="show sidebar"></button><aclass="logo-container"href="../actix_settings/index.html"><imgsrc="https://actix.rs/img/logo.png"alt=""></a></nav><navclass="sidebar"><divclass="sidebar-crate"><aclass="logo-container"href="../actix_settings/index.html"><imgsrc="https://actix.rs/img/logo.png"alt="logo"></a><h2><ahref="../actix_settings/index.html">actix_settings</a><spanclass="version">0.7.1</span></h2></div><divclass="sidebar-elems"><ulclass="block"><li><aid="all-types"href="all.html">All Items</a></li></ul><section><ulclass="block"><li><ahref="#structs">Structs</a></li><li><ahref="#enums">Enums</a></li><li><ahref="#traits">Traits</a></li><li><ahref="#types">Type Aliases</a></li></ul></section></div></nav><divclass="sidebar-resizer"></div><main><divclass="width-limiter"><rustdoc-search></rustdoc-search><sectionid="main-content"class="content"><divclass="main-heading"><h1>Crate <aclass="mod"href="#">actix_settings</a><buttonid="copy-path"title="Copy item path to clipboard">Copy item path</button></h1><spanclass="out-of-band"><aclass="src"href="../src/actix_settings/lib.rs.html#1-820">source</a> · <buttonid="toggle-all-docs"title="collapse all docs">[<span>−</span>]</button></span></div><detailsclass="toggle top-doc"open><summaryclass="hideme"><span>Expand description</span></summary><divclass="docblock"><p>Easily manage Actix Web’s settings from a TOML file and environment variables.</p>
<p>To get started add a <ahref="struct.BasicSettings.html#method.parse_toml"title="associated function actix_settings::BasicSettings::parse_toml"><code>Settings::parse_toml("./Server.toml")</code></a> call to the
<p>Overriding parts of the file can be done from values using <ahref="struct.BasicSettings.html#method.override_field"title="associated function actix_settings::BasicSettings::override_field"><code>Settings::override_field</code></a> or from
the environment using <ahref="struct.BasicSettings.html#method.override_field_with_env_var"title="associated function actix_settings::BasicSettings::override_field_with_env_var"><code>Settings::override_field_with_env_var</code></a>.</p>
<divclass="example-wrap ignore"><ahref="#"class="tooltip"title="This example is not tested">ⓘ</a><preclass="rust rust-example-rendered"><code><spanclass="kw">use </span>actix_settings::{ApplySettings <spanclass="kw">as _</span>, Mode, Settings};
</div></details><h2id="structs"class="section-header">Structs<ahref="#structs"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="struct"href="struct.ActixSettings.html"title="struct actix_settings::ActixSettings">ActixSettings</a></div><divclass="desc docblock-short">Settings types for Actix Web.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Address.html"title="struct actix_settings::Address">Address</a></div><divclass="desc docblock-short">A host/port pair for the server to bind to.</div></li><li><divclass="item-name"><aclass="struct"href="struct.BasicSettings.html"title="struct actix_settings::BasicSettings">BasicSettings</a></div><divclass="desc docblock-short">Wrapper for server and application-specific settings.</div></li><li><divclass="item-name"><aclass="struct"href="struct.NoSettings.html"title="struct actix_settings::NoSettings">NoSettings</a></div><divclass="desc docblock-short">Marker type representing no defined application-specific settings.</div></li><li><divclass="item-name"><aclass="struct"href="struct.Tls.html"title="struct actix_settings::Tls">Tls</a></div><divclass="desc docblock-short">TLS (HTTPS) configuration.</div></li></ul><h2id="enums"class="section-header">Enums<ahref="#enums"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="enum"href="enum.Backlog.html"title="enum actix_settings::Backlog">Backlog</a></div><divclass="desc docblock-short">The maximum number of pending connections.</div></li><li><divclass="item-name"><aclass="enum"href="enum.Error.html"title="enum actix_settings::Error">Error</a></div><divclass="desc docblock-short">Errors that can be returned from methods in this crate.</div></li><li><divclass="item-name"><aclass="enum"href="enum.KeepAlive.html"title="enum actix_settings::KeepAlive">KeepAlive</a></div><divclass="desc docblock-short">The server keep-alive preference.</div></li><li><divclass="item-name"><aclass="enum"href="enum.MaxConnectionRate.html"title="enum actix_settings::MaxConnectionRate">MaxConnectionRate</a></div><divclass="desc docblock-short">The maximum per-worker concurrent TLS connection limit.</div></li><li><divclass="item-name"><aclass="enum"href="enum.MaxConnections.html"title="enum actix_settings::MaxConnections">MaxConnections</a></div><divclass="desc docblock-short">The maximum per-worker number of concurrent connections.</div></li><li><divclass="item-name"><aclass="enum"href="enum.Mode.html"title="enum actix_settings::Mode">Mode</a></div><divclass="desc docblock-short">Marker of intended deployment environment.</div></li><li><divclass="item-name"><aclass="enum"href="enum.NumWorkers.html"title="enum actix_settings::NumWorkers">NumWorkers</a></div><divclass="desc docblock-short">The number of workers that the server should start.</div></li><li><divclass="item-name"><aclass="enum"href="enum.Timeout.html"title="enum actix_settings::Timeout">Timeout</a></div><divclass="desc docblock-short">A timeout duration in milliseconds or seconds.</div></li></ul><h2id="traits"class="section-header">Traits<ahref="#traits"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="trait"href="trait.ApplySettings.html"title="trait actix_settings::ApplySettings">ApplySettings</a></div><divclass="desc docblock-short">Extension trait for applying parsed settings to the server object.</div></li><li><divclass="item-name"><aclass="trait"href="trait.Parse.html"title="trait actix_settings::Parse">Parse</a></div><divclass="desc docblock-short">A specialized <code>FromStr</code> trait that returns <ahref="enum.Error.html"title="enum actix_settings::Error"><code>Error</code></a> errors</div></li></ul><h2id="types"class="section-header">Type Aliases<ahref="#types"class="anchor">§</a></h2><ulclass="item-table"><li><divclass="item-name"><aclass="type"href="type.Settings.html"title="type actix_settings::Settings">Settings</a></div><divclass="desc docblock-short">Convenience type alias fo