[−][src]Function envmnt::evaluate_and_load_file
pub fn evaluate_and_load_file<F>(
file: &str,
evaluate: F
) -> Result<(), EnvmntError> where
F: Fn(String) -> String,
Parses the provided env file and loads all environment variables.
Arguments
file
- The file path to load and parseevaluate
- Evalute function which will modify the read value before it is loaded into the environment
Example
extern crate envmnt; fn main() { let eval_env = |value: String| { let mut buffer = String::from("PREFIX-"); buffer.push_str(&value); buffer }; let output = envmnt::evaluate_and_load_file("./src/test/var.env", eval_env); assert!(output.is_ok()); }