[][src]Function envmnt::get_list_with_separator

pub fn get_list_with_separator<K: AsRef<OsStr>>(
    key: K,
    separator: &str
) -> Option<Vec<String>>

Returns the requested environment variable as a string vector.

Arguments

  • key - The environment variable name
  • 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()]
    );
}