Function strict_env::parse_or_default[][src]

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

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.