Expand description
Inspection and manipulation of the process’s environment.
This module contains functions to inspect various aspects such as environment variables, process arguments, the current directory, and various other important directories.
There are several functions and structs in this module that have a
counterpart ending in os. Those ending in os will return an OsString
and those without will return a String.
Modules
- Constants associated with the current target
Structs
- An iterator over the arguments of a process, yielding a
Stringvalue for each argument. - An iterator over the arguments of a process, yielding an
OsStringvalue for each argument. - The error type for operations on the
PATHvariable. Possibly returned fromenv::join_paths(). - An iterator that splits an environment variable into paths according to platform-specific conventions.
- An iterator over a snapshot of the environment variables of this process.
- An iterator over a snapshot of the environment variables of this process.
Enums
- The error type for operations interacting with environment variables. Possibly returned from
env::var().
Functions
- Returns the arguments that this program was started with (normally passed via the command line).
- Returns the arguments that this program was started with (normally passed via the command line).
- Returns the current working directory as a
PathBuf. - Returns the full filesystem path of the current running executable.
- home_dirDeprecatedReturns the path of the current user’s home directory if known.
- Joins a collection of
Paths appropriately for thePATHenvironment variable. - Removes an environment variable from the environment of the currently running process.
- Changes the current working directory to the specified path.
- Sets the environment variable
keyto the valuevaluefor the currently running process. - Parses input according to platform conventions for the
PATHenvironment variable. - Returns the path of a temporary directory.
- Fetches the environment variable
keyfrom the current process. - Fetches the environment variable
keyfrom the current process, returningNoneif the variable isn’t set or if there is another error. - Returns an iterator of (variable, value) pairs of strings, for all the environment variables of the current process.
- Returns an iterator of (variable, value) pairs of OS strings, for all the environment variables of the current process.