pub fn load_var_with_default<T: FromStr, S: BuildHasher>(
var_name: &'static str,
hashmap: Option<&HashMap<String, String, S>>,
default: &'static str,
) -> Result<T, Error>Expand description
Tries to load an environment variable by name and parse it into type T.
If the environment variable is not present, it returns a default value.
This function can also use a hashmap as a fallback or for testing purposes.
ยงErrors
- Parsing failed