Skip to main content

parse_or

Function parse_or 

Source
pub fn parse_or<T>(
    key: &str,
    expected: &'static str,
    default: T,
) -> Result<T, EnvError>
where T: FromStr,
Expand description

Reads and parses a variable, falling back to default when absent.

§Errors

EnvError::Invalid if present but malformed — substituting the default for a typo is how a server ends up listening on the wrong port.