diff options
| author | fleetingbytes <7075397+fleetingbytes@users.noreply.github.com> | 2023-04-03 16:46:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-03 16:46:43 +0200 |
| commit | c252f0d4044876509e08be27f82dbf0f33bc5cc2 (patch) | |
| tree | 5e06508da10d626fd6b44db645e0edccfd0913e4 /library/std | |
| parent | 9f1a3a131b3a32ac86f5d230357fff94b17c34cb (diff) | |
| download | rust-c252f0d4044876509e08be27f82dbf0f33bc5cc2.tar.gz rust-c252f0d4044876509e08be27f82dbf0f33bc5cc2.zip | |
add situation where var_os returns None
Re-introduced some of the former errors as situations where `None` is returned.
Diffstat (limited to 'library/std')
| -rw-r--r-- | library/std/src/env.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/library/std/src/env.rs b/library/std/src/env.rs index 3fcf96c761b..63338bd5876 100644 --- a/library/std/src/env.rs +++ b/library/std/src/env.rs @@ -236,7 +236,13 @@ fn _var(key: &OsStr) -> Result<String, VarError> { } /// Fetches the environment variable `key` from the current process, returning -/// [`None`] if the variable isn't set or there's another error. +/// [`None`] in the following situations: +/// +/// - the environment variable isn't set +/// - the environment variable's name contains +/// the equal sign character (`=`) or the NUL character +/// +/// If this is not desired, consider using [`var_os`]. /// /// Note that the method will not check if the environment variable /// is valid Unicode. If you want to have an error on invalid UTF-8, |
