Skip to content

Commit

Permalink
deploy: 66456ab
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Feb 14, 2024
1 parent 07db6b2 commit 06a3411
Show file tree
Hide file tree
Showing 25 changed files with 215 additions and 215 deletions.
2 changes: 1 addition & 1 deletion config/enum/fallback.html
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ <h1 id="fallback-variant"><a class="header" href="#fallback-variant">Fallback va
</ul>
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>let qux = Value::from_str(&quot;qux&quot;)?; // Value::Other(&quot;qux&quot;)
</span>let qux = Value::from_str("qux")?; // Value::Other("qux")
<span class="boring">}</span></code></pre></pre>

</main>
Expand Down
4 changes: 2 additions & 2 deletions config/enum/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ <h2 id="attribute-fields"><a class="header" href="#attribute-fields">Attribute f
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>#[derive(ConfigEnum)]
#[config(before_parse = &quot;UPPERCASE&quot;)]
#[config(before_parse = "UPPERCASE")]
enum ExampleEnum {
// ...
}
Expand Down Expand Up @@ -260,7 +260,7 @@ <h2 id="deriving-common-traits"><a class="header" href="#deriving-common-traits"
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>#[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(rename_all = &quot;kebab-case&quot;)]
#[serde(rename_all = "kebab-case")]
<span class="boring">}</span></code></pre></pre>

</main>
Expand Down
10 changes: 5 additions & 5 deletions config/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ <h2 id="usage"><a class="header" href="#usage">Usage</a></h2>

#[derive(Config)]
struct AppConfig {
#[setting(default = 3000, env = &quot;PORT&quot;)]
#[setting(default = 3000, env = "PORT")]
pub port: usize,

#[setting(default = true)]
pub secure: bool,

#[setting(default = vec![&quot;localhost&quot;.into()])]
#[setting(default = vec!["localhost".into()])]
pub allowed_hosts: Vec&lt;String&gt;,
}
<span class="boring">}</span></code></pre></pre>
Expand Down Expand Up @@ -257,9 +257,9 @@ <h3 id="loading-sources"><a class="header" href="#loading-sources">Loading sourc
</span><span class="boring">fn main() {
</span>use schematic::Format;

loader.code(&quot;secure: false&quot;, Format::Yaml)?;
loader.file(&quot;path/to/config.yml&quot;)?;
loader.url(&quot;https://ordomain.com/to/config.yaml&quot;)?;
loader.code("secure: false", Format::Yaml)?;
loader.file("path/to/config.yml")?;
loader.url("https://ordomain.com/to/config.yaml")?;
<span class="boring">}</span></code></pre></pre>
<blockquote>
<p>The format for files and URLs are derived from the trailing extension.</p>
Expand Down
12 changes: 6 additions & 6 deletions config/partial.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,21 @@ <h1 id="partials"><a class="header" href="#partials">Partials</a></h1>
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(default, deny_unknown_fields, rename_all = &quot;camelCase&quot;)]
#[serde(default, deny_unknown_fields, rename_all = "camelCase")]
pub struct PartialExampleConfig {
#[serde(skip_serializing_if = &quot;Option::is_none&quot;)]
#[serde(skip_serializing_if = "Option::is_none")]
pub number: Option&lt;usize&gt;,

#[serde(skip_serializing_if = &quot;Option::is_none&quot;)]
#[serde(skip_serializing_if = "Option::is_none")]
pub string: Option&lt;String&gt;,

#[serde(skip_serializing_if = &quot;Option::is_none&quot;)]
#[serde(skip_serializing_if = "Option::is_none")]
pub boolean: Option&lt;bool&gt;,

#[serde(skip_serializing_if = &quot;Option::is_none&quot;)]
#[serde(skip_serializing_if = "Option::is_none")]
pub array: Option&lt;Vec&lt;String&gt;&gt;,

#[serde(skip_serializing_if = &quot;Option::is_none&quot;)]
#[serde(skip_serializing_if = "Option::is_none")]
pub optional: Option&lt;String&gt;,
}
<span class="boring">}</span></code></pre></pre>
Expand Down
2 changes: 1 addition & 1 deletion config/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ <h3 id="serde-support"><a class="header" href="#serde-support">Serde support</a>
</span><span class="boring">fn main() {
</span>#[derive(Config)]
struct Example {
#[setting(rename = &quot;type&quot;)]
#[setting(rename = "type")]
pub type_of: SomeEnum,
}
<span class="boring">}</span></code></pre></pre>
Expand Down
4 changes: 2 additions & 2 deletions config/struct/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ <h1 id="default-values"><a class="header" href="#default-values">Default values<
</span><span class="boring">fn main() {
</span>#[derive(Config)]
struct AppConfig {
#[setting(default = &quot;/&quot;)]
#[setting(default = "/")]
pub base: String,

#[setting(default = 3000)]
Expand All @@ -200,7 +200,7 @@ <h1 id="default-values"><a class="header" href="#default-values">Default values<
#[setting(default = true)]
pub secure: bool,

#[setting(default = vec![&quot;localhost&quot;.into()])]
#[setting(default = vec!["localhost".into()])]
pub allowed_hosts: Vec&lt;String&gt;,
}
<span class="boring">}</span></code></pre></pre>
Expand Down
10 changes: 5 additions & 5 deletions config/struct/env.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ <h1 id="environment-variables"><a class="header" href="#environment-variables">E
</span><span class="boring">fn main() {
</span>#[derive(Config)]
struct AppConfig {
#[setting(default = 3000, env = &quot;PORT&quot;)]
#[setting(default = 3000, env = "PORT")]
pub port: usize,
}
<span class="boring">}</span></code></pre></pre>
Expand All @@ -199,7 +199,7 @@ <h2 id="container-prefixes"><a class="header" href="#container-prefixes">Contain
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>#[derive(Config)]
#[config(env_prefix = &quot;APP_&quot;)]
#[config(env_prefix = "APP_")]
struct AppConfig {
#[setting(default = 3000)]
pub port: usize,
Expand All @@ -212,13 +212,13 @@ <h3 id="nested-prefixes"><a class="header" href="#nested-prefixes">Nested prefix
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>#[derive(Config)]
#[config(env_prefix = &quot;APP_SERVER_&quot;)]
#[config(env_prefix = "APP_SERVER_")]
struct AppServerConfig {
// ...
}

#[derive(Config)]
#[config(env_prefix = &quot;APP_&quot;)]
#[config(env_prefix = "APP_")]
struct AppConfig {
#[setting(nested)]
pub server: AppServerConfig,
Expand All @@ -233,7 +233,7 @@ <h2 id="parsing-values"><a class="header" href="#parsing-values">Parsing values<
</span><span class="boring">fn main() {
</span>#[derive(Config)]
struct AppConfig {
#[setting(env = &quot;ALLOWED_HOSTS&quot;, parse_env = schematic::env::split_comma)]
#[setting(env = "ALLOWED_HOSTS", parse_env = schematic::env::split_comma)]
pub allowed_hosts: Vec&lt;String&gt;,
}
<span class="boring">}</span></code></pre></pre>
Expand Down
6 changes: 3 additions & 3 deletions config/struct/extend.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ <h2 id="single-source"><a class="header" href="#single-source">Single source</a>
}
<span class="boring">}</span></code></pre></pre>
<p>Example:</p>
<pre><code class="language-yaml">extends: &quot;./another/file.yml&quot;
<pre><code class="language-yaml">extends: "./another/file.yml"
</code></pre>
<h2 id="multiple-sources"><a class="header" href="#multiple-sources">Multiple sources</a></h2>
<p>The second pattern is with a list of strings, allowing multiple files or URLs to be extended. Each
Expand All @@ -211,8 +211,8 @@ <h2 id="multiple-sources"><a class="header" href="#multiple-sources">Multiple so
<span class="boring">}</span></code></pre></pre>
<p>Example:</p>
<pre><code class="language-yaml">extends:
- &quot;./another/file.yml&quot;
- &quot;https://domain.com/some/other/file.yml&quot;
- "./another/file.yml"
- "https://domain.com/some/other/file.yml"
</code></pre>
<h2 id="either-pattern"><a class="header" href="#either-pattern">Either pattern</a></h2>
<p>And lastly, supporting both a string or a list, using our built-in enum.</p>
Expand Down
6 changes: 3 additions & 3 deletions config/struct/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ <h2 id="attribute-fields"><a class="header" href="#attribute-fields">Attribute f
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>#[derive(Config)]
#[config(allow_unknown_fields, env_prefix = &quot;EXAMPLE_&quot;)]
#[config(allow_unknown_fields, env_prefix = "EXAMPLE_")]
struct ExampleConfig {
// ...
}
Expand All @@ -234,14 +234,14 @@ <h2 id="serde-support"><a class="header" href="#serde-support">Serde support</a>
layer merging.</p>
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>#[serde(default, deny_unknown_fields, rename_all = &quot;camelCase&quot;)]
</span>#[serde(default, deny_unknown_fields, rename_all = "camelCase")]
<span class="boring">}</span></code></pre></pre>
<p>However, the <code>deny_unknown_fields</code> and <code>rename_all</code> fields can be customized, and we also support
the <code>rename</code> field, both via the top-level <code>#[config]</code> attribute.</p>
<pre><pre class="playground"><code class="language-rust"><span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>#[derive(Config)]
#[config(allow_unknown_fields, rename = &quot;ExampleConfig&quot;, rename_all = &quot;snake_case&quot;)]
#[config(allow_unknown_fields, rename = "ExampleConfig", rename_all = "snake_case")]
struct Example {
// ...
}
Expand Down
8 changes: 4 additions & 4 deletions config/struct/validate.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ <h1 id="validation-rules"><a class="header" href="#validation-rules">Validation
#[setting(validate = schematic::validate::alphanumeric)]
pub secret_key: String,

#[setting(validate = schematic::validate::regex(&quot;^\.env&quot;))]
#[setting(validate = schematic::validate::regex("^\.env"))]
pub env_file: String,
}
<span class="boring">}</span></code></pre></pre>
Expand Down Expand Up @@ -226,7 +226,7 @@ <h2 id="validate-function"><a class="header" href="#validate-function">Validate
context: &amp;Context
) -&gt; Result&lt;(), ValidateError&gt; {
if !do_check(value) {
return Err(ValidateError::new(&quot;Some failure message&quot;));
return Err(ValidateError::new("Some failure message"));
}

Ok(())
Expand All @@ -250,7 +250,7 @@ <h3 id="factories"><a class="header" href="#factories">Factories</a></h3>

Box::new(move |value, _, _| {
if !pattern.is_match(value) {
return Err(ValidateError::new(&quot;Some failure message&quot;));
return Err(ValidateError::new("Some failure message"));
}

Ok(())
Expand All @@ -265,7 +265,7 @@ <h3 id="path-targeting"><a class="header" href="#path-targeting">Path targeting<
</span>use schematic::PathSegment;

ValidateError::with_segments(
&quot;Some failure message&quot;,
"Some failure message",
// [i].key
[PathSegment::Index(i), PathSegment::Key(key.to_string())]
)
Expand Down
Loading

0 comments on commit 06a3411

Please sign in to comment.