[−][src]Function envmnt::expand
pub fn expand(value: &str, options: Option<ExpandOptions>) -> String
Expands the provided string value by replacing the environment variables defined in it. The syntax of the environment variables is based on the type requested.
Arguments
value
- The value to expandexpansion_type
- The expanstion type (unix/windows/unix prefix/...)
Example
use envmnt::{ExpandOptions, ExpansionType}; fn main() { envmnt::set("MY_ENV", "my expanded value"); let mut options = ExpandOptions::new(); options.expansion_type = Some(ExpansionType::Unix); let value = envmnt::expand("Env: MY_ENV value is: ${MY_ENV}", Some(options)); assert_eq!("Env: MY_ENV value is: my expanded value", &value); }