parse_min

Function parse_min 

Source
pub fn parse_min<T>(
    key: &str,
    raw: Option<&str>,
    min: T,
    meaning: &str,
) -> Result<Option<T>, String>
where T: FromStr + PartialOrd + Display + Copy,
Expand description

Parse an optional numeric override, refusing a malformed or out-of-range value instead of silently substituting the default.

min is the smallest value that means anything for this key; meaning describes what the key controls and is quoted back in the error, because “invalid value” without saying what a valid one would be leaves the reader exactly where they started.

Returns Ok(None) when the variable is unset or blank — the caller applies its own documented default, which is the one case where defaulting is right because nobody asked for anything else.