type Env<'a> = &'a dyn Fn(&str) -> Option<String>;Expand description
How ${env:NAME} is resolved, handed to the parser rather than read out of
the process.
Not an abstraction for its own sake — it is what lets the tests supply an
environment without writing one. std::env::set_var is unsafe in edition
2024 because it can reallocate environ under a concurrent getenv, in any
thread, including one inside libc; cargo test runs this binary’s tests as
threads of a single process, and at least two of them read: term.rs looks
up MIRA_PTY_CHILD, and every tui.rs test that formats a timestamp reaches
localtime_r, which reads TZ. No lock closes that, because the libc reader
will not take it. Not writing does.