surrealdb_core

Macro lazy_env_parse

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

A macro that allows lazily parsing a value from the environment variable, with a fallback default value if the variable is not set or parsing fails.

§Parameters

  • $key: An expression representing the name of the environment variable.
  • $t: The type of the value to be parsed.
  • $default: The default value to fall back to if the environment variable is not set or parsing fails.

§Return Value

A lazy static variable of type std::sync::LazyLock, which holds the parsed value from the environment variable or the default value.