[][src]Function envmnt::set_list_with_separator

pub fn set_list_with_separator<K: AsRef<OsStr>>(
    key: K,
    values: &Vec<String>,
    separator: &str
)

Sets the provided string vector as an environment variable.

Arguments

  • key - The environment variable name
  • values - String vector of values
  • separator - The separator used to merge/split the values

Example

extern crate envmnt;

fn main() {
    envmnt::set_list_with_separator(
        "LIST_TEST_ENV",
        &vec!["1".to_string(), "2".to_string(), "3".to_string()],
        ",",
    );

    let values = envmnt::get_list_with_separator("LIST_TEST_ENV", ",").unwrap();
    assert_eq!(
        values,
        vec!["1".to_string(), "2".to_string(), "3".to_string()]
    );
}