Function key

Source
pub fn key() -> Option<String>
Expand description

The key this machine holds, when it holds one.

Read once, at the edge, and carried in. It used to be read inside the pass, from the process environment — which made the pass untestable by construction: the environment is one variable shared by every thread, and cargo test runs tests on threads. Four tests set and unset it around each other, and which one won depended on the interleaving: green on a machine with no key, red on a machine that had one. A value a function reads from the process rather than from its caller cannot be given to it.

The trimming and the empty check live here rather than at the call site, so that AEDE_ACOUSTID_KEY="" and no variable at all mean the same thing wherever the question is asked.