Function std::os::setenv[src]

pub fn setenv(n: &str, v: &str)

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

Example

fn main() { use std::os; let key = "KEY"; os::setenv(key, "VALUE"); match os::getenv(key) { Some(ref val) => println!("{}: {}", key, val), None => println!("{} is not defined in the environment.", key) } }
use std::os;

let key = "KEY";
os::setenv(key, "VALUE");
match os::getenv(key) {
    Some(ref val) => println!("{}: {}", key, val),
    None => println!("{} is not defined in the environment.", key)
}