Expand description
Shared truthiness parsing for boolean-ish environment-variable flags. Shared truthiness parsing for environment-variable flags.
Two flags in this crate read boolean-ish env vars — MINIEXTENDR_BACKTRACE
(backtrace.rs) and _R_CHECK_LIMIT_CORES_ (optionals/parallel.rs) — and
they used to disagree on what counts as “on” (true/1 vs. anything but
false). parse_bool is the single source of truth, deliberately aligned
with R’s own config_val_to_logical (tools/R/utils.R): a case-insensitive,
whitespace-trimmed match against explicit truthy/falsy sets.
Recognized values (case-insensitive, surrounding whitespace trimmed):
- truthy:
yes,true,1,on - falsy:
no,false,0,off, `` (empty)
Anything else is unrecognized (None) — the caller supplies the default,
so each flag keeps control of its own “garbage” policy (see the two call
sites for their deliberately different defaults).
Functions§
- parse_
bool 🔒 - Parse an environment-flag value as a boolean, using R’s
config_val_to_logicalrules (see module docs). ReturnsNonefor values outside the recognized truthy/falsy sets so the caller picks the default.