Skip to content
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
Prev Previous commit
Next Next commit
add situation where var_os returns None
Re-introduced some of the former errors as situations where `None` is returned.
  • Loading branch information
fleetingbytes authored Apr 3, 2023
commit c252f0d4044876509e08be27f82dbf0f33bc5cc2
8 changes: 7 additions & 1 deletion library/std/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down