Skip to main content

declare_knob

Macro declare_knob 

Source
macro_rules! declare_knob {
    ($ident:ident, $ty:ty, $default:expr, $doc:literal) => { ... };
}
Expand description

Declare a knob: a typed runtime setting resolved from override / environment / default, registered for listing.

The static is named exactly like the environment variable (the TRACT_ prefix included), so one grep finds both the declaration and any use, and the env-var name is derived from the identifier — there is no separate string to drift.

declare_knob!(TRACT_MY_FLAG, bool, false, "Enable the thing.");
// ... later ...
if TRACT_MY_FLAG.get() { /* ... */ }