parse_or_default

Function parse_or_default 

Source
pub fn parse_or_default<T: FromStr + Default>(name: &str) -> Result<T, Error>
where T::Err: Into<Box<dyn Error + Send + Sync>>,
Expand description

Like parse, but falls back to a default value when the environment variable is missing or empty.

The target type must implement Default.

ยงErrors

Returns an error if the requested environment variable contains invalid UTF-8 or has a value that cannot be parsed into the target type.