[][src]Function envmnt::expand

pub fn expand(value: &str, expansion_type: ExpansionType) -> 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 expand
  • expansion_type - The expanstion type (unix/windows/unix prefix/...)

Example

extern crate envmnt;

use envmnt::ExpansionType;

fn main() {
    envmnt::set("MY_ENV", "my expanded value");
    let value = envmnt::expand("Env: MY_ENV value is: ${MY_ENV}", ExpansionType::Unix);
    assert_eq!("Env: MY_ENV value is: my expanded value", &value);
}