Skip to main content

parse_env_bool

Function parse_env_bool 

Source
pub fn parse_env_bool(value: &str) -> Option<bool>
Expand description

Parse a boolean from an environment variable value.

Accepts common truthy and falsy values:

  • Truthy: “1”, “true”, “yes”, “y”, “on”
  • Falsy: “0”, “false”, “no”, “n”, “off”

§Arguments

  • value - The string value to parse

§Returns

Returns Some(true) for truthy values, Some(false) for falsy values, and None for empty or unrecognized values.