Function lrs::env::var

Retrieves the value of an environment variable, if any.

Syntax

fn var<S>(name: S) -> Result<&'static CStr, Errno>
    where S: AsRef<[u8]>,

Arguments

NameDescription
name

The name of the variable to be found.

Return value

Returns the value of the variable with name name or an empty string if the variable does not have a value.

Remarks

This function iterates over all environment variables. If if finds a variable whose whole string is equal to name, the empty string is returned. Otherwise it tries to split the variable at the first = character and compares the part before the = to name. If they compare equal, the part after the = is returned.