Skip to content

Commit 4514beb

Browse files
committed
docs: List default value for Environment::prefix_separator
List the default value for the `Environment::prefix_separator` property.
1 parent ad773ab commit 4514beb

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/env.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ 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+
/// Defaults to [`separator`](Environment::separator()) if that is set, otherwise `_`.
3032
prefix_separator: Option<String>,
3133

3234
/// Optional character sequence that separates each key segment in an environment key pattern.
@@ -96,8 +98,9 @@ impl Environment {
9698
/// Optional prefix that will limit access to the environment to only keys that
9799
/// begin with the defined prefix.
98100
///
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.
101+
/// The prefix is tested to be present on each key before it's considered to be part of the
102+
/// source environment. The separator character can be set through
103+
/// [`prefix_separator`](Environment::prefix_separator()).
101104
///
102105
/// For example, the key `CONFIG_DEBUG` would become `DEBUG` with a prefix of `config`.
103106
pub fn with_prefix(s: &str) -> Self {
@@ -124,7 +127,8 @@ impl Environment {
124127
self
125128
}
126129

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

0 commit comments

Comments
 (0)