pub fn environment_value(
environment: &[(OsString, OsString)],
name: &str,
) -> Option<OsString>Expand description
What:
Look one variable up the way C’s getenv does:
the first entry wins.
&[(OsString, OsString)] borrows a list of name/value pairs.
Option<OsString> is “an owned value or nothing”.
Why:
The overlay must read exactly what the Git child will read.
Returning an
owned copy keeps the function free of borrow bookkeeping for the caller.
In TS you’d write (pseudocode):
function environmentValue(environment: [string, string][], name: string): string | undefined;