Skip to content

docs: List default value for Environment::prefix_separator #660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ pub struct Environment {
/// Optional prefix that will limit access to the environment to only keys that
/// begin with the defined prefix.
///
/// A prefix with a separator of `_` is tested to be present on each key before its considered
/// to be part of the source environment.
/// The prefix is tested to be present on each key before it's considered to be part of the
/// source environment. The separator character can be set through
/// [`prefix_separator`](Environment::prefix_separator()).
///
/// For example, the key `CONFIG_DEBUG` would become `DEBUG` with a prefix of `config`.
prefix: Option<String>,

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

/// Optional character sequence that separates each key segment in an environment key pattern.
Expand Down Expand Up @@ -96,8 +98,9 @@ impl Environment {
/// Optional prefix that will limit access to the environment to only keys that
/// begin with the defined prefix.
///
/// A prefix with a separator of `_` is tested to be present on each key before its considered
/// to be part of the source environment.
/// The prefix is tested to be present on each key before it's considered to be part of the
/// source environment. The separator character can be set through
/// [`prefix_separator`](Environment::prefix_separator()).
///
/// For example, the key `CONFIG_DEBUG` would become `DEBUG` with a prefix of `config`.
pub fn with_prefix(s: &str) -> Self {
Expand All @@ -124,7 +127,8 @@ impl Environment {
self
}

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