Skip to main content

env_flag

Macro env_flag 

Source
macro_rules! env_flag {
    ($name:expr) => { ... };
}
Expand description

Reads a presence-style environment switch once and caches the answer.

Expands to a bool that is true when the variable is set to anything at all, including the empty string. The backing OnceLock belongs to the expansion, so two call sites naming the same variable get their own cache rather than sharing one; that keeps the macro usable from any crate without a registry, at the cost of one pointer-sized static each.

if env_flag!("CRANPOSE_SCENE_UPDATE_DIAG") {
    eprintln!("[scene-update-diag] dirty={dirty_nodes:?}");
}