surrealdb_core

Macro lazy_env_parse_or_else

Source
macro_rules! lazy_env_parse_or_else {
    ($key:expr, $t:ty, $default:expr) => { ... };
}
Expand description

Lazily parses an environment variable into a specified type. If the environment variable is not set or the parsing fails, it returns a default value.

§Parameters

  • $key: A string literal representing the name of the environment variable.
  • $t: The type to parse the environment variable into.
  • $default: A fallback function or constant value to be returned if the environment variable is not set or the parsing fails.

§Returns

A Lazy static variable that stores the parsed value or the default value.