Skip to main content

parse_bool_opt

Function parse_bool_opt 

Source
pub fn parse_bool_opt(val: &str) -> Option<bool>
Expand description

Tri-state parse for call sites that preserve their own default unless the value is a deliberate boolean choice.

Unlike parse_bool, an empty (or whitespace-only) value yields None — a variable declared without a value (common in Kubernetes manifests and Docker Compose files) must not override a default — and so does any unrecognized value.

§Returns

  • Some(true) - for truthy values (is_truthy)
  • Some(false) - for 0 | false | off | no
  • None - for empty or unrecognized values