Function std::os::setenvExperimental [-]  [+] [src]

pub fn setenv<T: BytesContainer>(n: &str, v: T)

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)
}