Module std::env
The program's arguments and environment variables, read from the root's Env into
Buf<u8>s (hence with Env, Alloc). They are bytes, as passed: an argument need not be UTF-8,
and its as_bytes() is a path as it is. The environment is a snapshot taken at process start.
In the simulated world (the library default, the playground) there are no arguments and no
variables; a test installs its own Env handler with the ones it wants.
Source: std/env.weir; committed interface: std/env.iface. Index
- fn
arg: Theith argument after the program's name (0 is the first),Nonepast the last. - fn
args_len: How many arguments follow the program's name. - fn
var: The value of the environment variablename,Nonewhen it is unset ornameis not a variable's name (empty, or holding=or a NUL byte).
fn arg
pub fn arg(i: usize) -> Option<Buf<u8>> with Env, Alloc
The ith argument after the program's name (0 is the first), None past the last.
Committed interface (std/env.iface):
bound Env: Env any
bound Alloc: Alloc any
aborts: Alloc.alloc
scheduling point: Env not quiet
fn args_len
pub fn args_len() -> usize with Env
How many arguments follow the program's name.
Committed interface (std/env.iface):
bound Env: Env any
may diverge
scheduling point: Env not quiet
fn var
pub fn var(name: &[u8]) -> Option<Buf<u8>> with Env, Alloc
The value of the environment variable name, None when it is unset or name is not a
variable's name (empty, or holding = or a NUL byte).
Committed interface (std/env.iface):
bound Env: Env any
bound Alloc: Alloc any
aborts: Alloc.alloc
scheduling point: Env not quiet