Skip to content

Commit 9984d8f

Browse files
authored
docs: List default value for Environment::prefix_separator (#660)
List the default value for the `Environment::prefix_separator` property. The default for `prefix_separator` is determined by: https://github.com/rust-cli/config-rs/blob/ad773ab9febb8e9064bfbbc75795506f224de68b/src/env.rs#L230-L234
2 parents b8a098f + ec1ed60 commit 9984d8f

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/env.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@ pub struct Environment {
2020
/// Optional prefix that will limit access to the environment to only keys that
2121
/// begin with the defined prefix.
2222
///
23-
/// A prefix with a separator of `_` is tested to be present on each key before its considered
24-
/// to be part of the source environment.
23+
/// The prefix is tested to be present on each key before it's considered to be part of the
24+
/// source environment. The separator character can be set through
25+
/// [`prefix_separator`](Environment::prefix_separator()).
2526
///
2627
/// For example, the key `CONFIG_DEBUG` would become `DEBUG` with a prefix of `config`.
2728
prefix: Option<String>,
2829

29-
/// Optional character sequence that separates the prefix from the rest of the key
30+
/// Optional character sequence that separates the prefix from the rest of the key.
31+
///
32+
/// Defaults to [`separator`](Environment::separator()) if that is set, otherwise `_`.
3033
prefix_separator: Option<String>,
3134

3235
/// Optional character sequence that separates each key segment in an environment key pattern.
@@ -96,8 +99,9 @@ impl Environment {
9699
/// Optional prefix that will limit access to the environment to only keys that
97100
/// begin with the defined prefix.
98101
///
99-
/// A prefix with a separator of `_` is tested to be present on each key before its considered
100-
/// to be part of the source environment.
102+
/// The prefix is tested to be present on each key before it's considered to be part of the
103+
/// source environment. The separator character can be set through
104+
/// [`prefix_separator`](Environment::prefix_separator()).
101105
///
102106
/// For example, the key `CONFIG_DEBUG` would become `DEBUG` with a prefix of `config`.
103107
pub fn with_prefix(s: &str) -> Self {
@@ -124,7 +128,9 @@ impl Environment {
124128
self
125129
}
126130

127-
/// Optional character sequence that separates the prefix from the rest of the key
131+
/// Optional character sequence that separates the prefix from the rest of the key.
132+
///
133+
/// Defaults to [`separator`](Environment::separator()) if that is set, otherwise `_`.
128134
pub fn prefix_separator(mut self, s: &str) -> Self {
129135
self.prefix_separator = Some(s.into());
130136
self

0 commit comments

Comments
 (0)