[][src]Function envmnt::get_list_with_options

pub fn get_list_with_options<K: AsRef<OsStr>>(
    key: K,
    options: &ListOptions
) -> Option<Vec<String>>

Returns the requested environment variable as a string vector.

Arguments

  • key - The environment variable name
  • options - See ListOptions

Example

extern crate envmnt;

fn main() {
    let mut options = envmnt::ListOptions::new();
    options.separator = Some(",".to_string());
    envmnt::set_list_with_options(
        "LIST_TEST_ENV",
        &vec!["1".to_string(), "2".to_string(), "3".to_string()],
        &options,
    );

    let values = envmnt::get_list_with_options("LIST_TEST_ENV", &options).unwrap();
    println!("List Values: {:?}", values);

    let same = envmnt::is_equal("LIST_TEST_ENV", "1,2,3");
    println!("Same: {}", same);
}