1
Fork 0

add situation where var_os returns None

Re-introduced some of the former errors as situations where `None` is returned.
This commit is contained in:
fleetingbytes 2023-04-03 16:46:43 +02:00 committed by GitHub
parent 9f1a3a131b
commit c252f0d404
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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,