Module std::envUnstable [-] [+] [src]

Inspection and manipulation of the process's environment.

This module contains methods to inspect various aspects such as environment varibles, process arguments, the current directory, and various other important directories.

Modules

consts

Constants associated with the current target

Structs

Args

An iterator over the arguments of a process, yielding an String value for each argument.

ArgsOs

An iterator over the arguments of a process, yielding an OsString value for each argument.

JoinPathsError

Error type returned from std::env::join_paths when paths fail to be joined.

SplitPaths

An iterator over Path instances for parsing an environment variable according to platform-specific conventions.

Vars

An iterator over a snapshot of the environment variables of this process.

VarsOs

An iterator over a snapshot of the environment variables of this process.

Enums

VarError

Possible errors from the env::var method.

Functions

args

Returns the arguments which this program was started with (normally passed via the command line).

args_os

Returns the arguments which this program was started with (normally passed via the command line).

current_dir

Returns the current working directory as a Path.

current_exe

Optionally returns the filesystem path to the current executable which is running but with the executable name.

get_exit_status

Fetches the process's current exit code. This defaults to 0 and can change by calling set_exit_status.

home_dir

Optionally returns the path to the current user's home directory if known.

join_paths

Joins a collection of Paths appropriately for the PATH environment variable.

page_size

Returns the page size of the current architecture in bytes.

remove_var

Remove a variable from the environment entirely.

set_current_dir

Changes the current working directory to the specified path, returning whether the change was completed successfully or not.

set_exit_status

Sets the process exit code

set_var

Sets the environment variable k to the value v for the currently running process.

split_paths

Parses input according to platform conventions for the PATH environment variable.

temp_dir

Returns the path to a temporary directory.

var

Fetches the environment variable key from the current process.

var_os

Fetches the environment variable key from the current process, returning None if the variable isn't set.

vars

Returns an iterator of (variable, value) pairs of strings, for all the environment variables of the current process.

vars_os

Returns an iterator of (variable, value) pairs of OS strings, for all the environment variables of the current process.