Function itconfig::get_vec_env_or_set_default[][src]

pub fn get_vec_env_or_set_default<T, D>(
    env_name: &str,
    sep: &str,
    default: Vec<D>
) -> Vec<T> where
    T: FromEnvString,
    D: ToEnvString
Expand description

This function is similar as get_vec_env_or_default, but the default value will be set to environment variable, if env variable is missed.

Panics

Application will panic if cannot parse variable to expected type

Example

use std::env;

fn main () {
    let result: Vec<bool> = get_vec_env_or_set_default("TESTING", ",", vec!["true"]);
    assert_eq!(result, vec![true]);

    let var = env::var("TESTING").unwrap();
    assert_eq!(var, "true");
}