Skip to main content

first_env_var_set

Function first_env_var_set 

Source
fn first_env_var_set<L>(
    vars: &[(&'static str, Option<&'static str>)],
    canonical: &'static str,
    lookup: &L,
) -> Result<(&'static str, String), EnvParseError>
where L: Fn(&str) -> Option<OsString>,
Expand description

The value of the first variable of vars that lookup finds, together with the name of that variable, warning about the deprecated ones on the way.

canonical is the variable a user should set, reported when none of them is.

A variable that is set but does not hold valid Unicode fails even when a lower-priority variable holds a usable value, because silently ignoring a variable the user did set would surprise them.